Basic HTML version of Foils prepared 23 June 1997

Foil 17 Embedded Variables

From JavaScript Tutorial for Certificate Course UC Web applications Certificate -- Summer 97. by Geoffrey C. Fox, Tom Scavo

JavaScript Entity
1 One can parameterize HTML using document.writeln()
2 commands such as:
3 document.writeln("str1" + JSvariable + "str2");
4 Another way of achieving this is by directly embedding the variable into the HTML, requiring no <SCRIPT> tag and no document.write():
5 <IMG WIDTH="&{JSvar1};" SRC="&{JSvar2};">
6 where JSvar1 and JSvar2 are JavaScript variables
7 Syntax is modeled after HTML special characters: for example, &gt; produces a literal greater than sign (>)
8 Such JavaScript entities can ONLY appear on the right-hand side of attribute value pairs
  • Cannot appear in arbitrary HTML text such as titles
  • The document.writeln approach has no such restriction!

in Table To:


Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Wed Apr 1 1998