Click to See Complete Forum and Search --> : syntax - not sure if its javascript or dhtml tho
serAph1m
09-24-2003, 02:21 PM
Im making a STRUTS application, and I ran across this dilemma - what do I do when there are doublequotes inside the single quotes inside the doublequotes of a window.location.href command?
example:
window.location.href= '<html:rewrite forward="attributes"/>?jmxItem=<bean:write name="result" filter="false" property="encodedBeanName"/>';
thanks!
You can escape them by using backslashes. This assumes that the string below is contained in double quotes...
window.location.href= '<html:rewrite forward=\"attributes\"/>?jmxItem=<bean:write name=\"result\" filter=\"false\" property=\"encodedBeanName\"/>';
serAph1m
09-24-2003, 02:31 PM
Originally posted by pyro
You can escape them by using backslashes. This assumes that the string below is contained in double quotes...
window.location.href= '<html:rewrite forward=\"attributes\"/>?jmxItem=<bean:write name=\"result\" filter=\"false\" property=\"encodedBeanName\"/>';
heh - cool. Like java/C. HTML/DHTML/Javascript deserves more credit from coders than it gets ;) :D
Originally posted by serAph1m
HTML/DHTML/Javascript deserves more credit from coders than it getsOnly if used correctly... ;)
serAph1m
09-24-2003, 02:40 PM
Originally posted by pyro
Only if used correctly... ;)
hehe indeed. :D
serAph1m
09-24-2003, 05:39 PM
strange - that line generates a "quote expected" error...
is there any way of just making it go back as if the back button was pressed? That'd probably be a lot easier...
Yep, but remember that it won't work for the 13% of users who do not have JavaScript enabled:
<a href="#" onclick="history.go(-1); return false;">Go Back</a>
serAph1m
09-25-2003, 03:17 PM
Originally posted by pyro
Yep, but remember that it won't work for the 13% of users who do not have JavaScript enabled:
<a href="#" onclick="history.go(-1); return false;">Go Back</a>
:( havent been able to test this until just now, but in that form it works - how would i integrate it into my event handling code to make it work when escape is pressed?
You might find this useful: http://www.infinitypages.com/research/keycode.htm