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] Quote Link to comment 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] Quote Link to comment 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 :) 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.