faqts : Computers : Programming : Languages : JavaScript : Document

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

28 of 31 people (90%) answered Yes
Recently 9 of 10 people (90%) answered Yes

Entry

Which browsers support JavaScript entities?
Are HTML Script Macros supported by any browser?

Mar 2nd, 2000 01:44
Martin Honnen,


NN3+ supports so called JavaScript entities as the value of an HTML 
attribute:
  <TAGNAME ATTRIBUTENAME="&{js code here};">
for instance
  <SCRIPT>
  var today = new Date().toString()
  </SCRIPT>

  <INPUT VALUE="&{today};">
JavaScript entities seem to be what
  http://www.w3.org/TR/REC-html40/appendix/notes.html#h-B.7
calls Script Macro.
Unfortunately IE3-5 don't support this handy way of dynamically setting 
HTML attribute values. So for cross browser code you are forced to use 
document.write e.g.
  <SCRIPT>
   document.write('<INPUT VALUE="' + today + '">');
  </SCRIPT>