javascript entities

J

jonathan Cook

I would like to set the value of a hidden input field to the value of
a javascript variable.

In HTML I have successfully done this by:
<input type="hidden" name="context" value="&{exists};"/>

However I now wish to put this into an xsl file and it complains about
the { characters.

If I change them so that I have:
<input type="hidden" name="context" value="&lsaquo;exists&rsaquo;"/>

Then I get an error along the lines of the entity lsaquo was
referenced, but not declared.

Bit stuck and would appreciate some help

Jonathan Cook
 
M

McKirahan

jonathan Cook said:
I would like to set the value of a hidden input field to the value of
a javascript variable.

In HTML I have successfully done this by:
<input type="hidden" name="context" value="&{exists};"/>

However I now wish to put this into an xsl file and it complains about
the { characters.

If I change them so that I have:
<input type="hidden" name="context" value="&lsaquo;exists&rsaquo;"/>

Then I get an error along the lines of the entity lsaquo was
referenced, but not declared.

Bit stuck and would appreciate some help

Jonathan Cook

I haven't heard of that before; where can I learn more?

Should the following work? -- it doesn't for me.

<html>
<head>
<title>var2html.htm</title>
<script type="text/javascript">
var http = "http://www.Google.com/";
</script>
</head>
<body>
<form>
<input type="text" name="context" value="&{http};"/>
</form>
</body>
</html>
 
M

Michael Winter

Really? I can only get it to work with NN4[1], which is hardly worth the
effort.

Can't say I know the requirements of XSL.

&lsaquo; isn't the same character as {. It's actually closer in form to
angle brackets. { and } are the left and right braces,
respectively.

[snip]
I haven't heard of that before; where can I learn more?

As I said at the outset, it isn't well supported at all (at least in my
experience). The Netscape JavaScript Guide for JS v1.3 mentions it briefly:

Should the following work? -- it doesn't for me.

In NN4, it does. Not in any other browser I've got, though.

[snip

Mike


[1] Other browsers tried: IE6, Opera 7.54, Netscape 7.2, Mozilla Firefox
0.9.3, and all major version of Mozilla from 1.0 to 1.7.3.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,194
Latest member
KarriWhitt

Latest Threads

Top