Dooq Posted April 11, 2006 Share Posted April 11, 2006 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 IEThanks Link to comment https://forums.phpfreaks.com/topic/7101-the-code-not-work-with-ie-6/ Share on other sites More sharing options...
GBS Posted April 20, 2006 Share Posted April 20, 2006 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,, Link to comment https://forums.phpfreaks.com/topic/7101-the-code-not-work-with-ie-6/#findComment-28804 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.