Adeus Posted February 28, 2008 Share Posted February 28, 2008 Hello, I am working with the following code. echo " <a href=\"javascript:void(0);\" onclick=\"return coolTip('<div id=\'ctInside\'><a href=\'JavaScript:goVisitSite(\'image.jpg\')\'><span class=\'lad\'>CLICK</span></a></div>', WIDTH, 430, HEIGHT, 230); return true;\" onmouseout=\"nd(); return true;\">IMAGE</a> "; Whenever I mouse over the link it generates, it only reads javascript:goVisitSite(. I've tried escaping it more than once, I've tried using double quotes, I've tried everything I could think of. Any suggestions are much appreciated! Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted February 28, 2008 Share Posted February 28, 2008 within cool tip, change " to " and ' to ' Quote Link to comment Share on other sites More sharing options...
Adeus Posted February 28, 2008 Author Share Posted February 28, 2008 I tried changing the quotes to their respective entities as you suggested, Little Guy. Unfortunately, it did not work. Is there something I can do to my JavaScript in the head? <script type="text/javascript" language="JavaScript"> function goVisitSite(Site) { NewWindow1 = window.open(Site, "viewwin", "toolbar=0,width=350,height=450,resizable=no,screenX=400,screenY=300"); } </script> Quote Link to comment Share on other sites More sharing options...
fenway Posted March 1, 2008 Share Posted March 1, 2008 within cool tip, change " to " and ' to ' That has nothing to do with JS. Pick a set of quotes (single or doubles) and stick with it... keep escaping (you'll need to double-escape). Better yet, make some variables! Quote Link to comment Share on other sites More sharing options...
svivian Posted March 5, 2008 Share Posted March 5, 2008 I think you might be missing a closing double quote from the onclick attribute. Can you post the output HTML here (i.e. from View Source in your browser)? I find that the easiest way to do quotes is to first decide what the JS code should be when in the HTML page, like this (abridged): <a href="javascript:void(0);" onclick="return coolTip('<div id=\'ctInside\'>...</div>')\'">link</a> (You'll need to do that "doubly" for the HTML inside the JS...) Then if you are going to echo that in your PHP code, if you are using double quotes, simply escape all double quotes in your HTML. If you have double quotes already escaped for javascript purposes you'll need to change them from \" to \\\" What you really ought to be doing though is not using HTML in a JS function call. Pass variables like the id and generate the HTML in the coolTip function. 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.