javascript entities

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • jonathan Cook

    javascript entities

    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
  • McKirahan

    #2
    Re: javascript entities

    "jonathan Cook" <jonathan@erars .demon.co.uk> wrote in message
    news:7f13b95.04 09220948.76d1d4 2b@posting.goog le.com...[color=blue]
    > 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[/color]

    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>


    Comment

    • Michael Winter

      #3
      Re: javascript entities

      On Wed, 22 Sep 2004 18:03:19 GMT, McKirahan <News@McKirahan .com> wrote:
      [color=blue]
      > "jonathan Cook" <jonathan@erars .demon.co.uk> wrote in message
      > news:7f13b95.04 09220948.76d1d4 2b@posting.goog le.com...
      >[color=green]
      >> 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 };"/>[/color][/color]

      Really? I can only get it to work with NN4[1], which is hardly worth the
      effort.
      [color=blue][color=green]
      >> However I now wish to put this into an xsl file and it complains about
      >> the { characters.[/color][/color]

      Can't say I know the requirements of XSL.
      [color=blue][color=green]
      >> If I change them so that I have:
      >> <input type="hidden" name="context" value="&lsaquo; exists&rsaquo;"/>[/color][/color]

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

      [snip]
      [color=blue]
      > I haven't heard of that before; where can I learn more?[/color]

      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:

      <URL:http://devedge.netscap e.com/library/manuals/2000/javascript/1.3/guide/embed.html#1013 293>
      [color=blue]
      > Should the following work? -- it doesn't for me.[/color]

      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.

      --
      Michael Winter
      Replace ".invalid" with ".uk" to reply by e-mail.

      Comment

      Working...