W3C home > Mailing lists > Public > www-style@w3.org > August 1998

How are char. entity refrences processed by browser?

From: Amit Rekhi <amit@abinfosys.com>
Date: Wed, 5 Aug 1998 14:27:05 +0530
Message-Id: <011d01bdc053$6853c1a0$0101a8c0@server.abinfosys.com>
To: "Style List" <www-style@w3.org>
Hello,
I have 2 code snippets and they have put me in doubt as to how char. entity
refrences are processed!

CODE SNIPPET 1
.
.
.
<HTML>
  <HEAD>
     <SCRIPT LANGUAGE="JSCRIPT"><![CDATA[
function Temp()
{
  var try = "&#38;&#34;";
  alert(try);
}
     ]]></SCRIPT>
    <TITLE>XSL GENERATED OUTPUT</TITLE>
  </HEAD>
  <BODY>
    <FORM name="ProductForm" OnSubmit="Temp()">
     <INPUT type="submit" value="SUBMIT FORM"/>
     <INPUT type="reset" value="CLEAR FORM"/>
    </FORM>
  </BODY>
</HTML>
.
.
.

* When temp() is invoked on form submission, I get a dialog box showing me
"&#38;&#34;" as it is.The text is not replaced by "(double quotes).WHY?

But in code snippet 2, &#34; gets properly substituted by "(double quotes)
when it is stored in the file temp.txt.

CODE SNIPPET 2
.
.
.
  <HTML>
    <FORM name="ProductForm" OnSubmit="
    var NewFile = new ActiveXObject('Scripting.FileSystemObject');
    var Response = NewFile.CreateTextFile(document.all.filename.value,true);
    var text = '&#34;';
    Response.Write(text);
    Response.Close();">
     <INPUT type="filename" value="c:\temp.txt"/>
     <INPUT type="submit" value="SUBMIT FORM"/>
    </FORM>
  </BODY>
</HTML>
.
.
.

Why is it that in CODE SNIPPET 1 the entitry refrence does not get replaced
whereas it does in the second case?
Thanks for any suggestions,


        AMIT
Received on Wednesday, 5 August 1998 05:28:56 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:53:55 GMT