External JavaScript Headache
Posted: Tue Feb 17, 2004 10:36 am
I've found lots of tutorials on including external JavaScripts but none of them addresses my problem, and as far as I can tell I'm doing everything correctly, so I'm putting this to all those with a bit more JavaScripting experience than myself as I imagine I've probably overlooked something very simple.
If I put some JavaScript in the head of a HTML page, such as:
and I put this in the actual HTML:
everything works fine.
But if I create the following file:
save it as js.js, then call it by:
in the head of the page - the same link doesn't work.
Can anyone tell me where I'm going wrong?
Thanks for your time.
If I put some JavaScript in the head of a HTML page, such as:
Code: Select all
<script language='JavaScript'>
<!--
function jsopen(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=425,height=250');");
}
// -->
</script>Code: Select all
<a href="javascript:jsopen('/path/to/a/file.php')">Link</a>)But if I create the following file:
Code: Select all
<!--
function jsopen(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=425,height=250');");
}
// -->Code: Select all
<script language='JavaScript' src='js.js' type='text/javascript'>Can anyone tell me where I'm going wrong?
Thanks for your time.