Jump to content

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
Link to comment
https://forums.phpfreaks.com/topic/7101-the-code-not-work-with-ie-6/
Share on other sites

  • 2 weeks later...
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,,
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.