You are here: irt.org | FAQ | JavaScript | notabug | Q1435 [ previous next ]
The following was submitted by Claude Schnéegans:
When a function is defined in a script inside a layer, it is not recognized. Variables are ok, but not functions. This affects all Netscape versions 4.x but not Internet Explorer .
You need to use the correct hierarchy to access the function within the layer:
<html> <script language="JavaScript"><!-- function test1() { alert('Test1 says var1 = "' + var1 + '", var2 = "' + var2 + '"'); } var1 = "Content 1" //--></script> <layer name="myLayer"> <a href="javascript:test1()">Test1</a> <br> <a href="javascript:document.myLayer.test2()">Test2</a> <script language="JavaScript"><!-- function test2() { alert('Test2 says var1 = "' + var1 + '", var2 = "' + var2 + '"'); } var2 = "Content 2" //--></script> </layer> </body> </html>