Anonymus: Variablen extern auslagern?

Beitrag lesen

Variablen extern auslagern?

Ich habe auf meiner Page viele Effecte, deren Ausehen man per Variaben verändern kann.
Nun möchte ich diese Variablen in einer externen Datei, den Quellcode des Effectes auch in einer externen Datei fassen.

Beispiel:

Der ursprüngliche Code:[CODE]var winheight=100
var winsize=100
var x=5

function openwindow(thelocation){
temploc=thelocation
if (!(window.resizeTo&&document.all)&&!(window.resizeTo&&document.getElementById)){
window.open(thelocation)
return
}
win2=window.open("","","scrollbars")
win2.moveTo(0,0)
win2.resizeTo(100,100)
go2()
}
function go2(){
if (winheight>=screen.availHeight-3)
x=0
win2.resizeBy(5,x)
winheight+=5
winsize+=5
if (winsize>=screen.width-5){
win2.location=temploc
winheight=100
winsize=100
x=5
return
}
setTimeout("go2()",50)
}[/CODE]

-------------------------------------------------------

Der Code ohne die Variablen: [CODE]

function openwindow(thelocation){
temploc=thelocation
if (!(window.resizeTo&&document.all)&&!(window.resizeTo&&document.getElementById)){
window.open(thelocation)
return
}
win2=window.open("","","scrollbars")
win2.moveTo(0,0)
win2.resizeTo(100,100)
go2()
}
function go2(){
if (winheight>=screen.availHeight-3)
x=0
win2.resizeBy(5,x)
winheight+=5
winsize+=5
if (winsize>=screen.width-5){
win2.location=temploc
winheight=100
winsize=100
x=5
return
}
setTimeout("go2()",50)
}[/CODE]

Die Variablen: [CODE]var winheight=100
var winsize=100
var x=5[/CODE]