...

View Full Version : innerhtml problem with NS



suhayda
12-27-2004, 04:23 PM
I have the following DIV in my html code:

<div id="testdiv">
&nbsp;
</div>

When I do
displayzone.innerHTML="<table><tr><td>test</td></tr></table>";
it works with iexplorer, opera, firefox but not with netscape.

Anyone knows a way to do this?

Thanks

A1ien51
12-27-2004, 05:00 PM
verison of netscape? If you say 4, it is a bunch of work to do it in an outdated browser.

Eric

suhayda
12-27-2004, 05:09 PM
Thanks

A1ien51
12-27-2004, 07:07 PM
How is displayzone defined? Showing more code will help.

Eric

Willy Duitt
12-27-2004, 07:16 PM
Building tables by using innerHTML is not supported since you can not add thead, tbody or tfoot which are required and if left out of the code, the browser rendering engine will add these elements by default...

Using innerHTML and appending a table to an already rendered document will not produce those required elements(which admittedly most people do not use but are added when the document is rendered)....

If you wish to create a table you will need to use the DOM and createElement()... Elsewise, build the table and give the data cells ID's and use getElementById() to change the innerHTML of the data cells...

.....Willy

suhayda
12-28-2004, 03:09 PM
<table width='800' cellpadding="0" cellspacing="0">
<tr><td width="630" valign='top'>
<div id="displayzone">
&nbsp;
</div>
</td>
<td>&nbsp; </td>
</tr>
</table>



</body>
<script language="JavaScript1.1" type="text/javascript">
var r = new Array();
var k = 0;

function sort(){
var dummy = new Array();
for (var i=1;i<k;++i){
for (var j=i+1;j<k+1;++j){
if (r[i][2]>r[j][2]){
dummy=r[i];
r[i]=r[j];
r[j]=dummy;
}
}
}
}


function showresults(){
sort();
var s="<table width='626' cellpadding='0' cellspacing='1'>";
var s=s+"<tr bgcolor='#284386' class='title'><td>&nbsp;Nr&nbsp;</td><td>&nbsp;Merchant&nbsp;</td><td>&nbsp;Airline&nbsp;</td><td>&nbsp;Price in US$&nbsp;</td><td>&nbsp;Info&nbsp;</td><td>&nbsp;Email&nbsp;</td></tr>";
var kback=0;
var background="";
for (var i=1;i<k+1;++i){
if (kback==0){
kback=1;
background="#E4ECF3";
} else {
kback=0;
background="#EDF1F5";
}
s=s+"<tr class='text' bgcolor='"+background+"'><td align='right'>"+i+".&nbsp;</td><td>&nbsp;"+r[i][0]+"</td><td>&nbsp;"+r[i][1]+"</td><td>&nbsp;"+r[i][2]+"</td><td>&nbsp;<a href=''><font size=2 color='#ff6300'><b>details</b></font></a></td><td align='center'><img src='/_temp/emailtof.gif' border=0 alt='Email this deal to a friend!'></td></tr>";
}
s=s+"</table>";
displayzone.innerHTML=s;
}
</script>Thread TEST Module<br>
#############RESULTS###############
<div id="displayzone2">
&nbsp;
</div>
###################################<br>

[1]Orbitz Done<br>ORBITZ PARSING START<br>
<script language="JavaScript1.1" type="text/javascript">
r[1]=new Array("Orbitz","United Airlines",104);
r[2]=new Array("Orbitz","US Airways",104);
r[3]=new Array("Orbitz","America West",104);
r[4]=new Array("Orbitz","Northwest Airlines",104);
r[5]=new Array("Orbitz","American Airlines",104);
r[6]=new Array("Orbitz","United Airlines",114);
r[7]=new Array("Orbitz","America West",114);
r[8]=new Array("Orbitz","American Airlines",114);
k=8;
showresults();
</script>ORBITZ PARSING DONE<br>[1]Intratours Done<br>INTRATOURS PARSING START<br>
<script language="JavaScript1.1" type="text/javascript">
r[9]=new Array("Intratours","United Airlines",138.20);
r[10]=new Array("Intratours","US Airways",138.20);
r[11]=new Array("Intratours","America West Airlines",138.20);
r[12]=new Array("Intratours","American Airlines",128.20);
k=12;
showresults();
</script>INTRATOURS PARSING DONE<br>[1]travelnow done<br>TRAVELNOW PARSING<br>
<script language="JavaScript1.1" type="text/javascript">
r[13]=new Array("Travelnow","AMERICA WEST",108.2);
r[14]=new Array("Travelnow","NORTHWEST",108.2);
r[15]=new Array("Travelnow","US AIRWAYS",108.2);
r[16]=new Array("Travelnow","UNITED AIRLINES",108.2);
r[17]=new Array("Travelnow","AMERICAN AIRLINES",108.2);
r[18]=new Array("Travelnow","AMERICA WEST",118.2);
r[19]=new Array("Travelnow","DELTA AIRLINES",119.3);
r[20]=new Array("Travelnow","DELTA AIRLINES",141.2);
r[21]=new Array("Travelnow","DELTA AIRLINES",155.2);
r[22]=new Array("Travelnow","UNITED AIRLINES",160.2);
k=22;
showresults();
</script>travelnow parse done<br>[1]cheapseats done<br>1800CHEAPSEATS PARSING START<br>

<script language="JavaScript1.1" type="text/javascript">
r[23]=new Array("1800CheapSeats","America West Airlines",98.2);
r[24]=new Array("1800CheapSeats","Northwest Airlines",98.2);
r[25]=new Array("1800CheapSeats","United Airlines",98.2);
r[26]=new Array("1800CheapSeats","US Airways",98.2);
r[27]=new Array("1800CheapSeats","American Airlines",98.2);
r[28]=new Array("1800CheapSeats","US Airways",108.2);
r[29]=new Array("1800CheapSeats","United Airlines",108.2);
r[30]=new Array("1800CheapSeats","United Airlines",131.2);
r[31]=new Array("1800CheapSeats","United Airlines",135.2);
r[32]=new Array("1800CheapSeats","United Airlines",145.2);
r[33]=new Array("1800CheapSeats","US Airways",145.2);
k=33;
showresults();
</script>1800CHEAPSEATS PARSING DONE<br><br>Listing running threads<br>[1:2:3:4:5:]<br>Engines status:<br>Orbitz: 1<br>Travelnow: 1<br>Cheapseats: 1<br>Intratours: 1<br>Priceline: 0<br>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum