Jump to content

Archived

This topic is now archived and is closed to further replies.

Dooq

the code not work with IE 6

Recommended Posts

Hi

this code dosent work with the IE6 but it work with FireFox.

[code]
document.getElementById( 'ShopCart' ).innerHTML = '<tr><td class="sub_cat"><img border="0" src="Image/product_img/product_thump/'+id+'.bng" height="20" width="20">'+document.getElementById( 'name' ).innerHTML+'<br />Q :<span id="quant_'+id+'">1</span></td></tr>'+document.getElementById( 'ShopCart' ).innerHTML;
[/code]

how can i fix it to work with IE

Thanks

Share this post


Link to post
Share on other sites
Hi there,

Maybe I've found a start for your anwser,.. not sure,,

I guess I'm right,, but, if "ShopCart" is the Id for your table,...

This code will not work with IE, but work with FF:
[code]
<html>
<body>

<table id="ShopCart">testing,,,
</table>

<script>
document.getElementById('ShopCart').innerHTML = '<tr><td ><img border="0" src="image1.jpg"></td></tr>';
</script>
</body>
</html>
[/code]
But this one will work with both IE & FF:
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]
<html>
<body>

<[b]div[/b] id="ShopCart">testing,,,
</[b]div[/b]>

<script>
document.getElementById('ShopCart').innerHTML = '<tr><td ><img border="0" src="image1.jpg"></td></tr>';
</script>
</body>
</html>
[/quote]
So, we could say the 'id' property is not running well using the < table > tag with IE,...

Also,... using the innerHTML function, it should remplace the all contents of the element 'ShopCart',... but with both FF & IE, as the "[b]testing,,,[/b]" word is in a table, & as it is not in a <tr/td> tag, it will be displayed normally,...
To test, this code will remove the "[b]testing,,,[/b]" word, as it is in a <td> tag,...
[code]
<html>
<body>

<table id="ShopCart"><td>testing,,,</td>
</table>

<script>
document.getElementById('ShopCart').innerHTML = '<tr><td ><img border="0" src="image1.jpg"></td></tr>';
</script>
</body>
</html>
[/code]

Hoping it helps,,

l8tr,,

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.