my html page like this:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>script.aculo.us Autocompleter functional test file</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<script src="../../lib/prototype.js" type="text/javascript"></script>
<script src="../../src/scriptaculous.js"
type="text/javascript"></script>
<script src="../../src/unittest.js" type="text/javascript"></script>
<style type="text/css" media="screen">
.selected { background-color: #888; }
</style>
<script>
var a=document.getElementsByTagName("script");
alert(a.length);
alert(a[0].src);
alert(a[1].src);
//alert(a[2]);
var arr=$A(document.getElementsByTagName("script")).fi ndAll(
function(s) {
//alert(s.src);
return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
});
//alert(arr[0]);
</script>
</head>
when executed in IE and FF,I get different results.
in IE,when alert(a.length) get 9,
in FF,when alert(a.length) get 2.
i look into scriptaculous.js,code like this:
var Scriptaculous = {
Version: '1.6.2',
require: function(libraryName) {
// inserting via DOM fails in Safari 2.0, so brute force approach
document.write('<script type="text/javascript"
src="'+libraryName+'"></script>');
},
load: function() {
if((typeof Prototype=='undefined') ||
(typeof Element == 'undefined') ||
(typeof Element.Methods=='undefined') ||
parseFloat(Prototype.Version.split(".")[0] + "." +
Prototype.Version.split(".")[1]) < 1.5)
throw("script.aculo.us requires the Prototype JavaScript
framework >= 1.5.0");
$A(document.getElementsByTagName("script")).findAl l( function(s) {
return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
}).each( function(s) {
var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
var includes = s.src.match(/\?.*load=([a-z,]*)/);
(includes ? includes[1] :
'builder,effects,dragdrop,controls,slider').split( ',').each(
function(include) { Scriptaculous.require(path+include+'.js')
});
});
}
}
Scriptaculous.load();
above code will dynamically generate tag <script>.....
i think i should be 9 instead of 2.
anyone can give your opinion?