I
"NecroJoe" <TA************************@hotmail.com> writes:
<SCRIPT language=JavaScript>
In HTML4, the type attribute is required, and it is always sufficient.
Use:
<script type="text/javascript">
function Add_Term(SearchTerm) {
window.opener.document.advsearch.name_title.value +=
SearchTerm;
window.close();
}
</SCRIPT>
<a href="javascript:Add_Term('This will work')">"Amarga Presencia"</a>
Don't use "javascript:"-URLs. <URL:http://jibbering.com/faq/#FAQ4_24>
<a href="javascript:Add_Term('This "won't" work')">"Amarga Presencia"</a>
No, the HTML attribute is surrounded by "'s, so you can't use them inside
it as well. Use:
---
<a href="javascript:Add_Term('This "won't" work')"> ...
---
(or rather:
---
<a href="needJS.html" onclick="Add_Term('This "won't" work')"> ...
---
)
How do I escape the " and ' characters properly ..?
What you need is the HTML escape, which is " for " and ' for '.
If you also need to nest quotes inside the Javascript, then use backslashes
to escape:
----
onclick="foo('ain\'t this "kosher"?');
bar("No \"dear\"!");"
---
This is HTML escape for this javascript:
---
foo('ain\'t this "kosher"?');
bar("No \"dear\"!");
---
I know this is basic
but I have tried \' and \" and cant think what else to do.
HTML escapes, not Javascript. :)
/L
--
Lasse Reichstein Nielsen -
lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'