hi frnds, i am getting "closeMe is not defined error" while checking in firefox i am posting my code below <html> <head> <title>File Upload</title> <script language="text/javaScript"> function closeMe() ( window.location = $donePage; ) </script> </head> <body> <p>your file $filename was successfully imported </p> <input type="button" VALUE="Done" onClick="javaScript:closeMe()" /> </body> </html> basically i am wokring on a CMS called interwoven ,and i want to refresh the CURRENT DIRECTORY in which i am working after uploading some file thr a custom utility which i have developed in CGI ,now i just need to refresh the form , the $donepage is the path for refreshing the page pls guide me if there is a way to just refresh the page and go back to current directory in javascript or atleast why this closeme is coming undefined when i have defined it and caling it correctly looking forward for a favorable response from your side regards, rahul
when you define the function why dont you use { } but ( )? does $donePage come with quotes/encapsulation, because if it's a string... it needs this in js. function closeMe() ( window.location = $donePage; ) should be: var closeMe = function() { window.location.href = "$donePage"; }; PHP: it is probably not defined because you have fatal exceptions on the page so js execution has ended prematurely.
First, you are using parenthesis where you should be using brackets: [B][COLOR="Blue"]<html> <head> <title>File Upload</title> <script language="text/javaScript"> function [COLOR="Red"][B]klose[/B][/COLOR]Me() [COLOR="Red"][B]{[/B][/COLOR] [COLOR="Red"][B]<< Bracket should be here for ease of reading[/B][/COLOR] window.location = $donePage; [COLOR="Red"][B]<< Indentation[/B][/COLOR] [COLOR="Red"][B]}[/B][/COLOR] </script> </head> <body> <p>your file $filename was successfully imported </p> <input type="button" VALUE="Done" onClick="javascript:[COLOR="Red"][B]klose[/B][/COLOR]Me()" /> </body> </html>[/COLOR][/B] Code (markup): Second, "close" IS a reserved word in js. So you should NEVER use anything like it in your code. Use "kloseMe" instead. I know from experience - took me days to realize that "close" refers to "window.close" and would not work in FF as a function name. Third, use indentation to make your code easier to read.