Kor
03-30-2005, 09:09 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<script language="JavaScript" type="text/JavaScript">
function createExternal(){
var root = document.getElementsByTagName('head')[0];
var oJs = document.createElement('script');
oJs.setAttribute('type','text/JavaScript');
oJs.setAttribute('src','myscript.js');
root.appendChild(oJs);
}
</script>
</head>
<body>
<input name="" type="button" value="fire the function" onclick="createExternal();bla()">
</body>
</html>
In myscript.js I have a simple function
function bla(){
alert('foo')
}
It works ok in IE, But Moz says thare is no function bla(). Now if I change a little bit the codes, everithing works ok:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<script language="JavaScript" type="text/JavaScript">
function createExternal(){
var root = document.getElementsByTagName('head')[0];
var oJs = document.createElement('script');
oJs.setAttribute('type','text/JavaScript');
oJs.setAttribute('src','s.js');
root.appendChild(oJs);
}
function alertV(v){
alert(v)
}
</script>
</head>
<body>
<input name="" type="button" value="fire the function" onclick="createExternal()">
</body>
</html>
and in external file:
alertV('foo')
I would like to know why Moz acts like that? is in the first variant incorrect? Or it is a Moz's bug?...
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<script language="JavaScript" type="text/JavaScript">
function createExternal(){
var root = document.getElementsByTagName('head')[0];
var oJs = document.createElement('script');
oJs.setAttribute('type','text/JavaScript');
oJs.setAttribute('src','myscript.js');
root.appendChild(oJs);
}
</script>
</head>
<body>
<input name="" type="button" value="fire the function" onclick="createExternal();bla()">
</body>
</html>
In myscript.js I have a simple function
function bla(){
alert('foo')
}
It works ok in IE, But Moz says thare is no function bla(). Now if I change a little bit the codes, everithing works ok:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<script language="JavaScript" type="text/JavaScript">
function createExternal(){
var root = document.getElementsByTagName('head')[0];
var oJs = document.createElement('script');
oJs.setAttribute('type','text/JavaScript');
oJs.setAttribute('src','s.js');
root.appendChild(oJs);
}
function alertV(v){
alert(v)
}
</script>
</head>
<body>
<input name="" type="button" value="fire the function" onclick="createExternal()">
</body>
</html>
and in external file:
alertV('foo')
I would like to know why Moz acts like that? is in the first variant incorrect? Or it is a Moz's bug?...