zq29 Posted March 1, 2006 Share Posted March 1, 2006 I have an image that is generated by PHP based on some form input fields, and to stream-line it I wan't to change the images without reloading the page. So JavaScript is the way! I have written the following script, which does exactly what I want, perfectly in FireFox - But does nothing in IE! Any ideas?[code]<script language="JavaScript">function reloadimg() { logo = document.getElementById("logo"); logo = logo.value; text = document.getElementById("text"); text = text.value; document.unbrand.src = "preview.php?str="+text+"&btm=s|1"; document.branded.src = "preview.php?str="+text+"&btm=c|"+logo;}</script>[/code]Now, logo is taken from a <select>, and text is taken from an <input>, both form fields have an onchange="reloadimg()" to trigger the function.I would say I am a novice at JavaScript, but slowly picking it up here and there. I'm assuming one of the functions I have used in my script is not compatible with IE? Any help is greatly appreciated![b]EDIT:[/b] Just noticed that IE is giving me this error in its error icon in the bottom left:[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Error: 'document.unbrand' is null or not an object[/quote]Here is my images that it is refering to:[code]<img id="unbrand" src="preview.php" alt="UnBranded Preview" border="0px"/><img id="branded" src="preview.php" alt="Branded Preview" border="0px"/>[/code] Link to comment https://forums.phpfreaks.com/topic/3838-solved-reloading-an-image/ Share on other sites More sharing options...
AndyB Posted March 1, 2006 Share Posted March 1, 2006 fingers crossed .... try adding a name to it <img name="whatever" etc.[a href=\"http://www.htmlgoodies.com/tutorials/web_graphics/article.php/3479941\" target=\"_blank\"]http://www.htmlgoodies.com/tutorials/web_g...cle.php/3479941[/a] Link to comment https://forums.phpfreaks.com/topic/3838-solved-reloading-an-image/#findComment-13354 Share on other sites More sharing options...
zq29 Posted March 1, 2006 Author Share Posted March 1, 2006 [!--quoteo(post=350712:date=Mar 1 2006, 06:05 PM:name=AndyB)--][div class=\'quotetop\']QUOTE(AndyB @ Mar 1 2006, 06:05 PM) [snapback]350712[/snapback][/div][div class=\'quotemain\'][!--quotec--]fingers crossed .... try adding a name to it <img name="whatever" etc.[a href=\"http://www.htmlgoodies.com/tutorials/web_graphics/article.php/3479941\" target=\"_blank\"]http://www.htmlgoodies.com/tutorials/web_g...cle.php/3479941[/a][/quote]Spot on! Thanks a bunch AndyB :) Link to comment https://forums.phpfreaks.com/topic/3838-solved-reloading-an-image/#findComment-13371 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.