tarun Posted April 3, 2007 Share Posted April 3, 2007 This Is My HTML <a href='' onMouseover=document.write('<img src=img.jpg>') ''>Hover Mouse Here</a> And It Doesn't Work I Get The Error "Unterminated string constant" Can AnyBody Help Me Please Thnx, Tarun Link to comment https://forums.phpfreaks.com/topic/45459-solved-js-with-the-a-href-tag/ Share on other sites More sharing options...
desithugg Posted April 4, 2007 Share Posted April 4, 2007 what exactly are you trying to do by adding <img src=img.jpg> Link to comment https://forums.phpfreaks.com/topic/45459-solved-js-with-the-a-href-tag/#findComment-221649 Share on other sites More sharing options...
desithugg Posted April 4, 2007 Share Posted April 4, 2007 are you trying to change images on mouse hover than try <head> <script language='javascript'> if (document.images) { poth00=new Image poth00.src='http://url.net/image1.png' poth01=new Image poth01.src='http://url.net/image2.png' }</script> </head> <img name='poth' src='default image url here'> <a href='#' onmouseover='document.poth.src=poth01.src' onmouseout='document.poth.src=poth00.src'>hover mouse here</a> Link to comment https://forums.phpfreaks.com/topic/45459-solved-js-with-the-a-href-tag/#findComment-221652 Share on other sites More sharing options...
tarun Posted April 5, 2007 Author Share Posted April 5, 2007 No I Want It Document.Write An Image But It Doesn't Work Its For A Profile Using BBCode [url='' onMouseover=document.write('<img src=img.jpg>') '']Hover Here[/url] Link to comment https://forums.phpfreaks.com/topic/45459-solved-js-with-the-a-href-tag/#findComment-221974 Share on other sites More sharing options...
Daniel0 Posted April 5, 2007 Share Posted April 5, 2007 This Is My HTML <a href='' onMouseover=document.write('<img src=img.jpg>') ''>Hover Mouse Here</a> And It Doesn't Work I Get The Error "Unterminated string constant" Can AnyBody Help Me Please Thnx, Tarun <a href='' onMouseover="document.write('<img src=\'img.jpg\'>')">Hover Mouse Here</a> You need quotes around the HTML attributes. Link to comment https://forums.phpfreaks.com/topic/45459-solved-js-with-the-a-href-tag/#findComment-222096 Share on other sites More sharing options...
mainewoods Posted April 5, 2007 Share Posted April 5, 2007 <a href='' onMouseover="document.write('<img src=\'img.jpg\'>')">Hover Mouse</a> the code above will overwrite the entire browser window with the image in ie. In ff it will overwite the window as well but will keep displaying the hourglass as if it's never loaded. Is that what you wanted? Instead maybe try this: <a href="#" onMouseover="document.getElementById('someDIVid').innerHTML = '<img src=\"img.jpg\">';">Hover Mouse</div> --will display the image within the div with the specified id Link to comment https://forums.phpfreaks.com/topic/45459-solved-js-with-the-a-href-tag/#findComment-222346 Share on other sites More sharing options...
tarun Posted April 6, 2007 Author Share Posted April 6, 2007 Cool Cool Topic Solved...? Link to comment https://forums.phpfreaks.com/topic/45459-solved-js-with-the-a-href-tag/#findComment-223120 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.