473,387 Members | 1,904 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

difference between IE and FF

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?

Dec 27 '06 #1
2 1795
alex wrote:
my html page like this:
[...]
Scriptaculous.load();
above code will dynamically generate tag <script>.....
i think i should be 9 instead of 2.
anyone can give your opinion?
In Firefox, getElementsByTagName doesn't work properly if used in the
head as the docment loads with dynamically created script elements.
Also, the scriptaculous "loader" script is crap. Try this thread for a
solution:

<URL:
http://groups.google.com.au/group/ru...c6a745/?hl=en#
>

--
Fred

Dec 27 '06 #2
Fred said the following on 12/27/2006 6:05 AM:
alex wrote:
>my html page like this:
[...]
>Scriptaculous.load();
above code will dynamically generate tag <script>.....
i think i should be 9 instead of 2.
anyone can give your opinion?

In Firefox, getElementsByTagName doesn't work properly if used in the
head as the docment loads with dynamically created script elements.
Also, the scriptaculous "loader" script is crap. Try this thread for a
solution:
All of that to simply load a .js file? Why make it so difficult?

<URL:
http://groups-beta.google.com/group/comp.lang.javascript/browse_thread/thread/145dcdbddbb78612/b604daea4acaa1a7?lnk=gst&q=loadJSFile&rnum=10#b604 daea4acaa1a7>

How much simpler can it get to load a .js file on the fly? And, it
doesn't matter if it is during page load or after.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Dec 27 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: jamesyreid | last post by:
Hi, I'm really sorry to post this as I know it must have been asked countless times before, but I can't find an answer anywhere. Does anyone have a snippet of JavaScript code I could borrow...
3
by: bbawa1 | last post by:
Hi, I have a table which has a field ItemsReceived of type datetime. I have a grid view which has two columns. In first column i have to show the data from field ItemsReceived and in second...
12
by: Petronius | last post by:
Hallo, does anyone have an idea how to implement difference lists in Javascript? Thanks allot in advance
5
by: Julius | last post by:
Hej dudes, I need to calc the difference between two timestamps / dates ... For example what i need to calculate: Date 1: 2007.11.06 - 20:13:04 Date 2: 2007.11.07 - 21:13:04 Difference:...
9
by: viki1967 | last post by:
Hi all! This new forum its great! :) Congratulations !!! My answer: why this my code not working? Nothing error but not work the difference.... : <html>
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.