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 Quote Link to comment 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,, Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.