Function does not always return value "}
10 отговора
221 прегледа
Function does not always return value "}
Kakvo oznachava tova suobshtenie za greshka v NS4.
Tova e v edin script za drag&drop. V IE e idealno.
Blake znam che ti razbirash ot Netscape. Tova suobshtenie govori li ti neshto?Function does not always return value "}"
Vsichkite skobi sum proveril - ne e tova.
Tova e v edin script za drag&drop. V IE e idealno.
Blake znam che ti razbirash ot Netscape. Tova suobshtenie govori li ti neshto?Function does not always return value "}"
Vsichkite skobi sum proveril - ne e tova.
Re: Function does not always return value "}
pusni skrtipta da go vidim :)
It`s more fun to compute
It`s more fun to compute
Re: Function does not always return value "}
taka de, dai malko code... otde da znam kva moje da e greshkata taka naum...
Just a genius
[email protected]
[линк]
Just a genius
[линк]
OK
Eto koda:
var concernedLayers=new Array()
concernedLayers[0]=new Array("info",300,40)
//syntax is: entry[x]=new Array(LAYERName, its_WIDTH, its_HEIGHT)
//you can go on with indexes [1], [2]...
var engagedZindex=0;
var engaged=null;
var obj1,obj2,style,X,Y,moveX,moveY,offsetX,offsetY;
//DOM detected build up:
if(document.getElementById){
obj1="document.getElementById('"
obj2="')"
style=".style"
X=(navigator.appName.indexOf("Internet Explorer")==-1)?
"e.clientX":"event.clientX";
Y=(navigator.appName.indexOf("Internet Explorer")==-1)?
"e.clientY":"event.clientY";
offsetX=(navigator.appName.indexOf("Internet Explorer")==-1)?
"pageXOffset":"document.body.scrollLeft"
offsetY=(navigator.appName.indexOf("Internet Explorer")==-1)?
"pageYOffset":"document.body.scrollTop"
}
else if(document.all){
obj1="document.all['"
obj2="']"
style=".style"
X="event.clientX"
Y="event.clientY"
offsetX="document.body.scrollLeft"
offsetY="document.body.scrollTop"
}
else if(document.layers){
obj1="document.layers['"
obj2="']"
style=""
X="e.pageX"
Y="e.pageY"
offsetX="pageXOffset"
offsetY="pageYOffset"
document.captureEvents(Event.MOUSEDOWN|Event.MOUSEMOVE|Event.MOUSEUP)
}
//DOM build up now over
function events(e){//argument must be set as e
var Xin=eval(X)
var Yin=eval(Y)
/*thanks to Dynamic HTML by Danny Goodman for
settings of following looping idea*/
for(var i=0;i<concernedLayers.length;i++){
var OGG=eval(obj1+concernedLayers[0]+obj2+style);
//is it visible?:
var visib=OGG.visibility
if(visib=="hidden"||
visib=="hide"){continue}
var layerW=concernedLayers[1]
var layerH=concernedLayers[2]
var L=parseFloat(OGG.left);//parseFloat: could carry a trailing "px" !
var T=parseFloat(OGG.top)
var offX=(document.layers)?0:eval(offsetX);//in case you scrolled
var offY=(document.layers)?0:eval(offsetY)
if(
Xin>(L-offX)&&Xin<(L-offX+layerW)&&
Yin>(T-offY)&&Yin<(T-offY+layerH))
{engaged=i;
moveX=Xin-L
moveY=Yin-T
return }
}
engaged=null
/*keep this comment to reuse freely
[линк] */
}
function disengage(){
if(engaged==null){return false}
moveX=null;
moveY=null;
engaged=null;
}
function dragLayer(e){
if(engaged==null){return false}
var Xin=eval(X)
var Yin=eval(Y)
var OGG=eval(obj1+ concernedLayers[engaged][0]+ obj2+ style)
//now move it
OGG.top=Yin-moveY
OGG.left=Xin-moveX
/*keep this comment to reuse freely
[линк] */
}
document.onmousedown=events
document.onmousemove=dragLayer
document.onmouseup=disengage
//-->
</script>
var concernedLayers=new Array()
concernedLayers[0]=new Array("info",300,40)
//syntax is: entry[x]=new Array(LAYERName, its_WIDTH, its_HEIGHT)
//you can go on with indexes [1], [2]...
var engagedZindex=0;
var engaged=null;
var obj1,obj2,style,X,Y,moveX,moveY,offsetX,offsetY;
//DOM detected build up:
if(document.getElementById){
obj1="document.getElementById('"
obj2="')"
style=".style"
X=(navigator.appName.indexOf("Internet Explorer")==-1)?
"e.clientX":"event.clientX";
Y=(navigator.appName.indexOf("Internet Explorer")==-1)?
"e.clientY":"event.clientY";
offsetX=(navigator.appName.indexOf("Internet Explorer")==-1)?
"pageXOffset":"document.body.scrollLeft"
offsetY=(navigator.appName.indexOf("Internet Explorer")==-1)?
"pageYOffset":"document.body.scrollTop"
}
else if(document.all){
obj1="document.all['"
obj2="']"
style=".style"
X="event.clientX"
Y="event.clientY"
offsetX="document.body.scrollLeft"
offsetY="document.body.scrollTop"
}
else if(document.layers){
obj1="document.layers['"
obj2="']"
style=""
X="e.pageX"
Y="e.pageY"
offsetX="pageXOffset"
offsetY="pageYOffset"
document.captureEvents(Event.MOUSEDOWN|Event.MOUSEMOVE|Event.MOUSEUP)
}
//DOM build up now over
function events(e){//argument must be set as e
var Xin=eval(X)
var Yin=eval(Y)
/*thanks to Dynamic HTML by Danny Goodman for
settings of following looping idea*/
for(var i=0;i<concernedLayers.length;i++){
var OGG=eval(obj1+concernedLayers[0]+obj2+style);
//is it visible?:
var visib=OGG.visibility
if(visib=="hidden"||
visib=="hide"){continue}
var layerW=concernedLayers[1]
var layerH=concernedLayers[2]
var L=parseFloat(OGG.left);//parseFloat: could carry a trailing "px" !
var T=parseFloat(OGG.top)
var offX=(document.layers)?0:eval(offsetX);//in case you scrolled
var offY=(document.layers)?0:eval(offsetY)
if(
Xin>(L-offX)&&Xin<(L-offX+layerW)&&
Yin>(T-offY)&&Yin<(T-offY+layerH))
{engaged=i;
moveX=Xin-L
moveY=Yin-T
return }
}
engaged=null
/*keep this comment to reuse freely
[линк] */
}
function disengage(){
if(engaged==null){return false}
moveX=null;
moveY=null;
engaged=null;
}
function dragLayer(e){
if(engaged==null){return false}
var Xin=eval(X)
var Yin=eval(Y)
var OGG=eval(obj1+ concernedLayers[engaged][0]+ obj2+ style)
//now move it
OGG.top=Yin-moveY
OGG.left=Xin-moveX
/*keep this comment to reuse freely
[линк] */
}
document.onmousedown=events
document.onmousemove=dragLayer
document.onmouseup=disengage
//-->
</script>
Re: OK
sadeiki po greshkata koyato ti dava (che ne funkciata ne vrashta '}') se nataknah na slednoto neshto (koeto predpolagam e problema)- (chervenoto):
var concernedLayers=new Array()
concernedLayers[0]=new Array("info",300,40)
//syntax is: entry[x]=new Array(LAYERName, its_WIDTH, its_HEIGHT)
//you can go on with indexes [1], [2]...
var engagedZindex=0;
var engaged=null;
var obj1,obj2,style,X,Y,moveX,moveY,offsetX,offsetY;
//DOM detected build up:
if(document.getElementById){
obj1="document.getElementById('"
obj2="')"
style=".style"
X=(navigator.appName.indexOf("Internet Explorer")==-1)?
"e.clientX":"event.clientX";
Y=(navigator.appName.indexOf("Internet Explorer")==-1)?
"e.clientY":"event.clientY";
offsetX=(navigator.appName.indexOf("Internet Explorer")==-1)?
"pageXOffset":"document.body.scrollLeft"
offsetY=(navigator.appName.indexOf("Internet Explorer")==-1)?
"pageYOffset":"document.body.scrollTop"
}
else if(document.all){
obj1="document.all['"
obj2="']"
style=".style"
X="event.clientX"
Y="event.clientY"
offsetX="document.body.scrollLeft"
offsetY="document.body.scrollTop"
}
else if(document.layers){
obj1="document.layers['"
obj2="']"
style=""
X="e.pageX"
Y="e.pageY"
offsetX="pageXOffset"
offsetY="pageYOffset"
document.captureEvents(Event.MOUSEDOWN|Event.MOUSEMOVE|Event.MOUSEUP)
}
//DOM build up now over
function events(e){//argument must be set as e
var Xin=eval(X)
var Yin=eval(Y)
/*thanks to Dynamic HTML by Danny Goodman for
settings of following looping idea*/
for(var i=0;i<concernedLayers.length;i++){
var OGG=eval(obj1+concernedLayers[0]+obj2+style);
//is it visible?:
var visib=OGG.visibility
if(visib=="hidden"||
visib=="hide"){continue}
var layerW=concernedLayers[1]
var layerH=concernedLayers[2]
var L=parseFloat(OGG.left);//parseFloat: could carry a trailing "px" !
var T=parseFloat(OGG.top)
var offX=(document.layers)?0:eval(offsetX);//in case you scrolled
var offY=(document.layers)?0:eval(offsetY)
if(
Xin>(L-offX)&&Xin<(L-offX+layerW)&&
Yin>(T-offY)&&Yin<(T-offY+layerH))
{engaged=i;
moveX=Xin-L
moveY=Yin-T
return }
}
engaged=null
/*keep this comment to reuse freely
[линк] */
}
function disengage(){
if(engaged==null){return false}
moveX=null;
moveY=null;
engaged=null;
}
function dragLayer(e){
if(engaged==null){return false}
var Xin=eval(X)
var Yin=eval(Y)
var OGG=eval(obj1+ concernedLayers[engaged][0]+ obj2+ style)
//now move it
OGG.top=Yin-moveY
OGG.left=Xin-moveX
/*keep this comment to reuse freely
[линк] */
}
document.onmousedown=events
document.onmousemove=dragLayer
document.onmouseup=disengage
//-->
</script>
Just a genius
[email protected]
[линк]
var concernedLayers=new Array()
concernedLayers[0]=new Array("info",300,40)
//syntax is: entry[x]=new Array(LAYERName, its_WIDTH, its_HEIGHT)
//you can go on with indexes [1], [2]...
var engagedZindex=0;
var engaged=null;
var obj1,obj2,style,X,Y,moveX,moveY,offsetX,offsetY;
//DOM detected build up:
if(document.getElementById){
obj1="document.getElementById('"
obj2="')"
style=".style"
X=(navigator.appName.indexOf("Internet Explorer")==-1)?
"e.clientX":"event.clientX";
Y=(navigator.appName.indexOf("Internet Explorer")==-1)?
"e.clientY":"event.clientY";
offsetX=(navigator.appName.indexOf("Internet Explorer")==-1)?
"pageXOffset":"document.body.scrollLeft"
offsetY=(navigator.appName.indexOf("Internet Explorer")==-1)?
"pageYOffset":"document.body.scrollTop"
}
else if(document.all){
obj1="document.all['"
obj2="']"
style=".style"
X="event.clientX"
Y="event.clientY"
offsetX="document.body.scrollLeft"
offsetY="document.body.scrollTop"
}
else if(document.layers){
obj1="document.layers['"
obj2="']"
style=""
X="e.pageX"
Y="e.pageY"
offsetX="pageXOffset"
offsetY="pageYOffset"
document.captureEvents(Event.MOUSEDOWN|Event.MOUSEMOVE|Event.MOUSEUP)
}
//DOM build up now over
function events(e){//argument must be set as e
var Xin=eval(X)
var Yin=eval(Y)
/*thanks to Dynamic HTML by Danny Goodman for
settings of following looping idea*/
for(var i=0;i<concernedLayers.length;i++){
var OGG=eval(obj1+concernedLayers[0]+obj2+style);
//is it visible?:
var visib=OGG.visibility
if(visib=="hidden"||
visib=="hide"){continue}
var layerW=concernedLayers[1]
var layerH=concernedLayers[2]
var L=parseFloat(OGG.left);//parseFloat: could carry a trailing "px" !
var T=parseFloat(OGG.top)
var offX=(document.layers)?0:eval(offsetX);//in case you scrolled
var offY=(document.layers)?0:eval(offsetY)
if(
Xin>(L-offX)&&Xin<(L-offX+layerW)&&
Yin>(T-offY)&&Yin<(T-offY+layerH))
{engaged=i;
moveX=Xin-L
moveY=Yin-T
return }
}
engaged=null
/*keep this comment to reuse freely
[линк] */
}
function disengage(){
if(engaged==null){return false}
moveX=null;
moveY=null;
engaged=null;
}
function dragLayer(e){
if(engaged==null){return false}
var Xin=eval(X)
var Yin=eval(Y)
var OGG=eval(obj1+ concernedLayers[engaged][0]+ obj2+ style)
//now move it
OGG.top=Yin-moveY
OGG.left=Xin-moveX
/*keep this comment to reuse freely
[линк] */
}
document.onmousedown=events
document.onmousemove=dragLayer
document.onmouseup=disengage
//-->
</script>
Just a genius
[линк]
Re: OK
Абсолютно прав си Блейк, няма какво да предполагаш. За съжаление джаваскрипт си остава недомислен полуезик за "скриптиране". Тъй като езика не изисква да се слагат ; след изразите /*което е безумно тъпо*/, интерпретаторът не пренебрегва знака за връщане на каретката/нов ред, а се опитва да го чете и да прави изводи от него. Логично след като след return няма нито ; нито нов ред, той счита, че функцията трябва да върне "}". Ако пича постави къдравата скоба на нов ред, би трябвало да няма проблеми. Освен ако не е сбъркал броя отварящи/затварящи, което не съм го броил.
It`s more fun to compute
It`s more fun to compute
Re: OK
mi to az po princip VINAGI slagam ; sled vsichko... taka che tozi problem ne sam go sreshtal dosega...
Just a genius
[email protected]
[линк]
Just a genius
[линк]
Ех...
Паскал-ската школа си казва думата 
There are three determined states the cat could be in: Alive, Dead, and Bloody Furious.
There are three determined states the cat could be in: Alive, Dead, and Bloody Furious.
Re: Ех...
Ne znam momcheta, no i sled slagane na " ; "
sled return, i sled slagane na " } "
na nov red , greshkata prodalzava dase iaviava v NS4.
sled return, i sled slagane na " } "
na nov red , greshkata prodalzava dase iaviava v NS4.
Re: Ех...
Добре де...пренапиши си функцията така, че да няма нужда да го слагаш този return изобщо.
"Да живееш - значи да се променяш." - Анатол Франс
"Да живееш - значи да се променяш." - Анатол Франс
Re: Ех...
ам, човече, преброй си затварящите и отварящи скоби, че аз нямам време. Ако всичко е наред, или послушай Дакота, или май е по-лесно да сложиш
ретурн труе, вместо само ретурн. Ебах го ако и тогава не сработи.
It`s more fun to compute
ретурн труе, вместо само ретурн. Ебах го ако и тогава не сработи.
It`s more fun to compute