Portal Home > Knowledgebase > Articles Database > External Javascript Files


External Javascript Files




Posted by Powi, 06-11-2007, 04:17 PM
Hi, this code works for IE and Firefox... but it is giving me problems with Safari and Opera... And I have NO idea why! grrrrr I'm trying to use it at: http://nueva.kaoz-tutorials.com/ In fact. If I View the code form Opera it marks it RED... Thanks Powi

Posted by Tyler, 06-11-2007, 04:37 PM
It's supposed to be red in Opera. Try to remove the slash, to see if that helps at all, since it's not really needed.

Posted by plumsauce, 06-11-2007, 04:55 PM
removing the slash will cause problems as soon as you use a different base href. instead, try using the full path to the file like this: http://example.com/jspublic.js

Posted by foobic, 06-11-2007, 07:23 PM
The red marking could be because it's invalid - type is a requirement for script tags: Still, I'd be surprised if that stopped it working - maybe the base as already suggested or could it be something in the script itself?

Posted by WorldCom, 06-12-2007, 07:05 AM
I'm sure someone will correct me if I'm wrong but by putting the slash in front aren't you indicating a directory instead of a file? I will assume that the JS file is in the same directory as the parent file. You could use plumsauces solution which will work as you are fully qualifying the location. As for why it works on some browsers and not on others, there is always wierd kind off error correcting for some that make things work.

Posted by Xeentech, 06-12-2007, 07:20 AM
jspublic.js means the 'jspublic.js' file is in the root dir of the web site, and is perfectly valid. All my script includes are Using that format you can have the calling HTML file in any dir and the browser just requests '/jspublic.js' and the HTTPd knows where to look. Perhaps its the script itself?

Posted by Powi, 06-12-2007, 10:15 AM
Hi again. Problem solved! 1) As Xeentech said before, the slash in /jspublic.js means that the file is in the root dir. It's Ok and I need it that way. 2) The line of code appears in red in opera because ALL scripts appear in red in Opera's View Source window, and not because of an error. 3) The script didn't work because it had a function goto(), and Opera doesn’t accept that name (seems IE and Firefox do accept it). So I changed the name to menugoto() and it works just fine know! Thanks for all your help! Regards Powi

Posted by Xeentech, 06-12-2007, 11:03 AM
Good to know, any idea why goto() is special Powi?



Was this answer helpful?

Add to Favourites Add to Favourites    Print this Article Print this Article

Also Read
Top Resellers (Views: 479)
Companies honesty ? (Views: 449)