Welcome to WebmasterWorld Guest from 22.214.171.124
Forum Moderators: open
I use the following code to link from an XHTML 1.0. page to an external script:-
On the same page I call a function:-
All standard stuff and wirks fine in IE6 and NN6. But Opera 6.05 always returns an error alert.
message: Reference to undefined variable: No such variable 'myfunction'
If I put the script in the page head, then it finds the function OK.
I have tried calling the function by onClick but that doesn't work either.
Is there anything I have to do for external scripts to work in Opera?
Thanks in advance.
Opera Version 6.05
System Windows 2000
validated XHTML 1.0 transitional and CSS2
Actually the link is on the site in my profile. Top left labelled "Swap bar". It would be interesting to see if anybody else has the same problem, or if it's something to do with my Opera installation.
If the name of the js file includes the word "script" Opera does not load the file. If I change the name, then Opera loads the file.
Presumably Opera gets confused if another word "script" appears between the <script> tag and </script>. It doesn't mind "scripts" or "scriptanything", but fails on the exact match.
The js file url was "domain/scripts-js/lib-script.js". It is now "domain/scripts-js/lib-standard.js", and Opera loads it.
Of course I still have a second problem, because now Opera is objecting to "innerHTML", but at least its no longer giving those misleading messages. :)
Many thanks for all your help.
You might find this link useful then:
Thanks DrDoc but I've already been there. "innerHTML" is not supported by Opera. There's a thread about it here which suggests using the DOM method, but doesn't actually provide any example code. So I'll have to do some digging.