Another way to call JavaScript code is to use a pseudo URL. When a URL that begins with javascript: is loaded, the code behind that is executed, as can be seen in the preceding code (file url.html). There are several ways to use such a URLin the form of an image, a link, or a CSS stylebut usually it's the link you will want to use. Note, however, that such a link obviously works only with a browser that supports JavaScript and has it activated. Warning When the code after the javascript: URL prefix returns something, the result is printed to the screen. Usually, this is not desirable. You can use the special JavaScript function void() to avoid this: javascript:void(code_that_would_return_something()); |