Click to See Complete Forum and Search --> : Requesting help on a script


micjohnson
07-11-2003, 07:06 PM
ok, where should i start... well I have been trying for the past 3 days to write a script that will change an applet at the click of a button. I have tried scripts using the document.write feature but it puts it on a new page, I am looking for a way for the applet to "refresh" and be a new value heres the code i tried<html>
<head>

<SCRIPT language=JavaScript>
var i=null
function go ()
{
if (i == null){}
else
y=i;
document.write ('<applet codebase="applet.com/" code="lsl08" width="284" height="212"><param name="po" value="1"><param name="channel" value="'+y+'"></applet>');
}
</SCRIPT>
</head>
<body>
<input type=button onclick="javascript:i=1; go()" value=1>
</body>
</html>

The part that I want to change is the <param name="channel" value="'+y+'"> part. Can anyone help me??:confused:

AdamBrill
07-11-2003, 07:23 PM
Try this:<html>
<head>

<SCRIPT language=JavaScript>
var i=null
function go (){
if (i != null){}
y=i;
document.getElementById('1').innerHTML = '<applet codebase="applet.com/" code="lsl08" width="284" height="212"><param name="po" value="1"><param name="channel" value="'+y+'"></applet>';
}
</SCRIPT>
</head>
<body>
<div id=1></div>
<input type=button onclick="javascript:i=1; go()" value=1>
</body>
</html>
BTW, javascript in the input line doesn't have a space... ;)

micjohnson
07-11-2003, 07:28 PM
hmm tried that there seams to be an error..:(

AdamBrill
07-11-2003, 07:30 PM
You have to take the space out of the this part:

onclick="java script:i=1; go()"

it should be:

onclick="javascript:i=1; go()"

micjohnson
07-11-2003, 07:52 PM
hmmm it seems to work up until the applet tries to load then it doesnt work... I know that i typed it in right...any idea why that might happen?