PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Java Script document.all für Firefox umschreiben?


Gast
2009-10-28, 03:12:48
Hallo!

Ich bin immer dafür die Fehler selbst zu finden aber dieses mal würde ich eure Hilfe benötigen. Es geht um ein älteres Java Script was im Firefox nicht funktioniert.

Habe gelesen das man alles wo "document.all.xxx" durch document.getElementById("xxx") umschreiben soll, ich habe das zwei Stunden probiert und kam leider zu keinem Ergebnis. Es wäre toll wenn mir jemand helfen könnte:

Hier ist das Script:


<script language="JavaScript1.2">

/*Browsercheck:*/
ie=document.all?1:0
n=document.layers?1:0

/******************************************************************************** *
These are the variables you have to set:
******************************************************************************** */

file://The speed of the timeout between each scroll.
timSpeed=10

file://The height of the container (change this when it scrolls to much or to little)
contHeight=100

/******************************************************************************** *
This is the object constructor function, which applies
methods and properties to the Cross-browser layer object
******************************************************************************** */
function makeScrollObj(obj,nest){
nest=(!nest) ? '':'document.'+nest+'.'
this.css=(n) ? eval(nest+'document.'+obj):eval('document.all.'+obj+'.style')
this.scrollHeight=n?this.css.document.height:eval('document.all.'+obj+'.offsetHe ight')
this.top=b_gettop
return this
}
file://Getting the top for the top method
function b_gettop(){
var gleft=(n) ? eval(this.css.top):eval(this.css.pixelTop);
return gleft;
}
file://Variables
var scrollTim;
var active=0;
/******************************************************************************** *
The scroll function. Checks what way to scroll and checks if the
layer is not already on top or bottom.
******************************************************************************** */
function scroll(speed){
clearTimeout(scrollTim)
way=speed>0?1:0
if((!way && oScroll[active].top()>-oScroll[active].scrollHeight+contHeight) || (oScroll[active].top()<0 && way)){
oScroll[active].css.top=oScroll[active].top()+speed
scrollTim=setTimeout("scroll("+speed+")",timSpeed)
}
}
file://Clears the timeout so the scroll stops, this is called onmouseout.
function noScroll(){
clearTimeout(scrollTim)
}
/******************************************************************************** *
Changes the active layer. Hides the one that's visible and
shows the "new" one. Also set's the new layers top to
0 so it starts at top.
******************************************************************************** */
function changeActive(num){
oScroll[active].css.visibility='hidden'
active=num
oScroll[active].css.top=0
oScroll[active].css.visibility='visible'
}
/******************************************************************************** *
Initilizes the page, makes a oScroll Array and calls the object constructor.
Here you can add as many scrollObjects as you want
******************************************************************************** */
function scrollInit(){
oScroll=new Array()
oScroll[00]=new makeScrollObj('divScroll00','divCont')
oScroll[0].css.visibility='visible'
}
</script>

Danke für jede Hilfe und schöne Grüsse

Coda
2009-10-28, 04:05:33
Du brauchst wohl getElementsByTagName()

Allerdings ist der Code schon ziemlich grausig. Am besten gleich mit jQuery neu schreiben.

The_Invisible
2009-10-28, 13:48:39
wenn ich document.all schon sehe stellsts mir schon die haare auf und ruft böse erinnernungen auf :freak:

ansonsten bin ich auch codas meinung :)

mfg

Gast
2009-10-29, 17:34:53
Danke für eure Antworten! Wo und wie oft soll ich das getElementsByTagName() einbauen? Kenne mich leider mit Java Script noch nicht so gut aus deswegen ist neu schreiben im Moment noch nicht so einfach für mich. Bin mehr auf PHP fixiert, wo auch nicht so viel Unterschied ist.