• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

Javascript funtion onload

Izanagi

n00b
Joined
Aug 15, 2004
Messages
15
I am trying to generate some HTML lines when my page loads but it is not working.
I have tried the innerHTML command but it doesnt seem to work.
Note:It will be in a PHP page on final release.
Any idea?

My HTML:
Code:
......
<HEAD>
<script type='text/javascript' src='Design.js'></script>
<script type='text/javascript'>
var BackDims = new Array();
var SeatDims = new Array();
BackDims[0] = new Array("BackWidthU", "Back Width (Upper)", "33");
BackDims[1] = new Array("BackWidthL", "Back Width (Lower)", "");
.......
</SCRIPT>  
</HEAD>
<BODY onLoad='SetVariables()'>
<table id='BackTable'>
<tr>
<td></td>
</tr>
</table>
........

My Design.js
Code:
function SetVariables()
{
ChangeBack();
ChangeSeat();
}

function ChangeBack()
{
var i;
var BackTable=document.getElementById('BackTable');
BackTable.rows[0].cells[0].innerHTML="<applet CODE="Seat.class" WIDTH="760" HEIGHT="500">";
for(i=0; i < 17; i++)
  {
  BackTable.rows[0].cells[0].innerHTML="<param type='text' name='"+BackDims[i][0]+"' value='"+BackDims[i][2]+"'/>";
  }
BackTable.rows[0].cells[0].innerHTML="</applet>";
}
......
 
That didn't work.
I have an example that works. Will try running through it again.
 
Quoting issue?

BackTable.rows[0].cells[0].innerHTML="<applet CODE="Seat.class" WIDTH="760" HEIGHT="500">";

try it as
BackTable.rows[0].cells[0].innerHTML='<applet CODE="Seat.class" WIDTH="760" HEIGHT="500">';

Using single wrapping quotes instead of double quotes. Otherwise the interpreter may not know what to do with the string.
 
This may have been already addressed. In any case, isn't the cell content being overwritten with each operation instead of being concat'd? You could try:

Code:
BackTable.rows[0].cells[0].innerHTML = BackTable.rows[0].cells[0].innerHTML + 'new stuff here';
Or...
Code:
BackTable.rows[0].cells[0].innerHTML += 'new stuff here';
Otherwise, the end result would just return "</applet>"... no?
 
Quoting issue?

BackTable.rows[0].cells[0].innerHTML="<applet CODE="Seat.class" WIDTH="760" HEIGHT="500">";

try it as
BackTable.rows[0].cells[0].innerHTML='<applet CODE="Seat.class" WIDTH="760" HEIGHT="500">';

Using single wrapping quotes instead of double quotes. Otherwise the interpreter may not know what to do with the string.

I agree, it looks like a quoting issue. Use \" to specify a quote inside quotes.
 
This
Code:
for(i=0; i < 17; i++)
  {
  BackTable.rows[0].cells[0].innerHTML="<param type='text' name='"+BackDims[i][0]+"' value='"+BackDims[i][2]+"'/>";
  }
Needs to be:
Code:
for(i=0; i < 17; i++)
  {
  BackTable.rows[0].cells[0].innerHTML+="<param type='text' name='"+BackDims[i][0]+"' value='"+BackDims[i][2]+"'/>";
  }
Otherwise your overwriting every line with the previous passed string.
 
Back
Top