You are here: irt.org | FAQ | JavaScript | Misc | Q210 [ previous next ]
<html> <head> <base target="_top"> <script language="JavaScript"><!-- function myfunction() { alert("Hello World!"); } //--></script> </head> <body> <a href="javascript:myfunction()">some link text<\/a> </body>
Because of the BASE tag in the head of the document, the link is targeting the URL javascript:GetLoc() into the _top window. If the _top window does not contain a JavaScript function called myfunction() then an error message will appear.
Visualise the URL as: javascript:_top.myfunction(), and you'll see why it fails.