my if... else. statements are not working.

G

Guest

please can someone tell me what i am doing wrong.

if i //comment out// the lines that start parent. the script work to
the end.

but with the parent line it does not get to the end of the script. and my
div's are not updated on the other page.
if i was to have just one of the (if else) parts shown below, the Avocado
part of the script. it works ok with the parent. lines.
but when i start to add more if else lines it does not want to know.

thank you.


function showorders()
{


alert("start of show orders script")

var form = document.forms.favororders;

if (form.Avocado.value==0) {
alert("avocado=0");
parent.orderlistcell.document.getElementById('bAvocado').innerHTML = "";
} else {
alert("avocado not 0");
parent.orderlistcell.document.getElementById('bAvocado').innerHTML = "avo
not 0";
}

if (form.ButterSquash.value==0) {
alert("ButterSquash 0");
parent.orderlistcell.document.getElementById('bButterSquash').innerHTML =
"";
} else {
alert("ButterSquash not 0");
parent.orderlistcell.document.getElementById('bButterSquash').innerHTML =
"butter not 0";
}

if (form.Cauliflower.value==0) {
alert("Cauliflower 0");
parent.orderlistcell.document.getElementById('bCauliflower').innerHTML = "";
} else {
alert("Cauliflower not 0");
parent.orderlistcell.document.getElementById('bCauliflower').innerHTML =
"caul not 0";
}

alert("end of show orders script")

}
 
G

Guest

just wanted to show another script that i have done still with not luck.
the if statements work seperately from each other, and are not in any
way connected,



function showorders()
{


alert("start of show orders script")

var form = document.forms.favororders;

if (form.Avocado.value==0) {
alert("avocado=0");
parent.orderlistcell.document.getElementById('bAvocado').innerHTML =
"avo=0";
} else {
alert("avocado not 0");
parent.orderlistcell.document.getElementById('bAvocado').innerHTML = "avo
not 0";
}

if (form.ButterSquash.value==0) {
alert("ButterSquash 0");
parent.orderlistcell.document.getElementById('bButterSquash').innerHTML =
"butt=0";
} else {
alert("ButterSquash not 0");
parent.orderlistcell.document.getElementById('bButterSquash').innerHTML =
"but not 0";
}

if (form.Cauliflower.value==0) {
alert("Cauliflower 0");
parent.orderlistcell.document.getElementById('bCauliflower').innerHTML =
"caul=0";
} else {
alert("Cauliflower not 0");
parent.orderlistcell.document.getElementById('bCauliflower').innerHTML =
"caul not 0";
}

alert("end of show orders script")

}
 
S

Steve Easton

Have you by chance tried working on this using the script editor.
With the page open, click Tools > Macro > Microsoft Script Editor


--
Steve Easton
Microsoft MVP FrontPage
95isalive
This site is best viewed..................
...............................with a computer
 
G

Guest

sorry I have no idea how to work this program. I spent almost an hour
working on it just now and have tried it in the past.

I have no idea how you get to RUN the script, I click the buttons and it
flashes and stuff but is that it?

oh yes I have looked at the help files, still none the wise.

I have added break points to stop it at certain points of the script to see
what is happening, but it just stops and what next? I have no idea how to
view the variables.

in the old days in BASIC it would look something like



if (a=1) then print "a equals 1"
else print "a did not equal 1"
endif

if (b=2) then print ""b equals 2"
else print "b did not equal 2"
endif




but at the moment the scripts I have posted below are only doing the first
IF ELSE statements and then the rest of the script ends, as though I have a
return() in between the first and second if else statements.
but as you can see I don't.
 
J

Jens Peter Karlsen [FP MVP]

Try this instead:

function showorders()
{
alert("start of show orders script");
var form = document.forms.favororders;
if (form.Avocado.value==0) {
alert("avocado=0");
parent.document.getElementById('bAvocado').innerHTML = "";
}
else {
alert("avocado not 0");
parent.document.getElementById('bAvocado').innerHTML = "avo not 0";
}

if (form.ButterSquash.value==0) {
alert("ButterSquash 0");
parent.document.getElementById('bButterSquash').innerHTML = "";
}
else {
alert("ButterSquash not 0");
parent.document.getElementById('bButterSquash').innerHTML = "butter not 0";
}

if (form.Cauliflower.value==0) {
alert("Cauliflower 0");
parent.document.getElementById('bCauliflower').innerHTML = "";
}
else {
alert("Cauliflower not 0");
parent.document.getElementById('bCauliflower').innerHTML = "caul not 0";
}
alert("end of show orders script");
}


Regards Jens Peter Karlsen. Microsoft MVP - Frontpage.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top