3 Replies Latest reply on Mar 30, 2010 9:56 AM by actionscafe

    Java Script error

    Pavlov's Man Level 1

      Hi, I keep on getting this error when I try to preview my page. While executing onLoadin_afterSave.htm,the following JavaScript error(s) occured in file"_afterSave": afterSave is not defined. I have no idea how to fix this. Can someone with more experience please help? Thanks!

        • 1. Re: Java Script error
          actionscafe Level 1



          This simply means that the script has come to a point during execution where the variable afterSave is referenced but the variable has not been defined somewhere in the script. The script could also be looking for a function named afterSave and it can't be found.


          Open the script in Dreamweaver or a text editor and do a search for the word afterSave. If it's a variable that's used in only one function, initialize it as a local variable within that function with the line "var afterSave". If it's a value that's used in several functions, initialize it as a global variable with the same line placed above the first function in the script. If it's a missing function, you have problems.

          • 2. Re: Java Script error
            Pavlov's Man Level 1

            Where do I find script in dreamweaver?

            • 3. Re: Java Script error
              actionscafe Level 1

              That's a good question.


              The script could be on-page - look at the page in source code view and see if it's there.


              If not, the script should be in a script file that is linked to the page - look at the page in source view and look for a <script... line similar to this "<script type="text/javascript" src="DWGlobalScripts/AGRScriptLib.js"></script>". The path to the script file is  "src="DWGlobalScripts/AGRScriptLib.js".


              If it's a Dreamweaver script it should be somewhere inside the Dreamweaver > configuration > folder, I would think.
              Try the page in IE8 Win or Firefox Mac or Win. In Firefox select Tools > Error console when the error pops up. Error will be listed in this window. IE8 will pop-up a window with the error and ask if you want to debug the source. Say yes, and the script will be listed in the debug source window.