JavaScript URLs can be used in the HREF attribute of an anchor tag. If this technique is used, a fragment of JavaScript code can call in an external function and generate the content of another page without ever calling a web server for the page.
Quite sophisticated dynamic page generation can be accomplished like this, however, at some stage you will have to have downloaded the JavaScript code to be executed in the first place.
<HTML> <BODY> <SCRIPT> var the_value = 100; function increment() { the_value++; } </SCRIPT> <A HREF="javascript:alert(the_value)">Click to display the value</A> <A HREF="javascript:increment()">Click to increment the value</A> </BODY> </HTML>
See also: | JavaScript Image Source URL, javascript: URL |
Prev | Home | Next |
JavaScript debugger console | Up | JavaScript embedded in Java |
JavaScript Programmer's Reference, Cliff Wootton Wrox Press (www.wrox.com) Join the Wrox JavaScript forum at p2p.wrox.com Please report problems to support@wrox.com © 2001 Wrox Press. All Rights Reserved. Terms and conditions. |