if not defined
Hi
I have the below code, which does not work. I am not able to get into my if statement
I have tried :
If (myBox[taeller])
If (myBox[taeller]=="true")
If (myBox[taeller]=='true')
If (myBox[taeller]= myBox[taeller])
If (myBox[taeller]== myBox[taeller])
None of the above are working, I know a bit of asp coding so I thought I could understand java script, but it does not look like it.
I hope there is somebody who can help
Code :
function droppedOnDropBox(evt) {
var dropbox = document.getElementById("dropbox");
var dropbox2 = document.getElementById("dropbox2");
var x = getX(dropbox);
var y = getY(dropbox);
var x2 = getX(dropbox2);
var y2 = getY(dropbox2);
var width = getWidth(dropbox);
var height = getHeight(dropbox);
var width2 = getWidth(dropbox2);
var height2 = getHeight(dropbox2);
var Box1, Box2;
var taeller;
var myBox=new Array();
Box1 = evt.x > x &&
evt.y > y &&
evt.x < x + width &&
evt.y < y + height;
Box2 = evt.x > x2 &&
evt.y > y2 &&
evt.x < x2 + width2 &&
evt.y < y2 + height2;
myBox[0] = Box1;
myBox[1] = Box2;
for (taeller in myBox)
{
alert(myBox[taeller]);
If (myBox[taeller])
{
/* Det er her jeg ikke kan komme ind */
alert("If Bingo");
}
/* return myBox[taeller]; */
}
}
Hi
I have the below code, which does not work. I am not able to get into my if statement
I have tried :
If (myBox[taeller])
If (myBox[taeller]=="true")
If (myBox[taeller]=='true')
If (myBox[taeller]= myBox[taeller])
If (myBox[taeller]== myBox[taeller])
None of the above are working, I know a bit of asp coding so I thought I could understand java script, but it does not look like it.
I hope there is somebody who can help
Code :
function droppedOnDropBox(evt) {
var dropbox = document.getElementById("dropbox");
var dropbox2 = document.getElementById("dropbox2");
var x = getX(dropbox);
var y = getY(dropbox);
var x2 = getX(dropbox2);
var y2 = getY(dropbox2);
var width = getWidth(dropbox);
var height = getHeight(dropbox);
var width2 = getWidth(dropbox2);
var height2 = getHeight(dropbox2);
var Box1, Box2;
var taeller;
var myBox=new Array();
Box1 = evt.x > x &&
evt.y > y &&
evt.x < x + width &&
evt.y < y + height;
Box2 = evt.x > x2 &&
evt.y > y2 &&
evt.x < x2 + width2 &&
evt.y < y2 + height2;
myBox[0] = Box1;
myBox[1] = Box2;
for (taeller in myBox)
{
alert(myBox[taeller]);
If (myBox[taeller])
{
/* Det er her jeg ikke kan komme ind */
alert("If Bingo");
}
/* return myBox[taeller]; */
}
}