Re: my 'if' comands are still not working. please help
- From: MikeR <nf4l@xxxxxxxxx>
- Date: Mon, 23 May 2005 13:36:03 -0400
Jason - Sorry, but you're over my head. I don't know how to handle those objects. Good luck. MikrR
cheers wrote:
if i put it this way, as i have tried to explain exactly what i want to do but not got very far.
the more i ask the more i find better ways to explain.
i have an order page mostly written in javascript. (it's been fun)
not this part though.
the IF statement and using the information from the form in one iframe in another iframe for processing, so it shows the orders made. (the posting of the orders is not an issue here, it is sent to a file on the sever.)
i have added alert("alert1") with the number changed every time i use it. to see what is happening.
first i think i need to get the form issue sorted.
is there a site that is just about forms, and how to access the data within forms while in another frame.
the document......
and parent......
commands are really confusing, in the way it is used. i need to find how to use these correctly.
i have:
function showorders() { alert("start of show orders script"); form = document.forms.favororders; document.write(form.Avocado.value); alert("end of show orders script"); }
but the only line that work is the first alert, the rest is not working, or executed.
i have checked the spellings and the case of the letters, all are correct.
omiting the document.write.... line the script run from start to finish showing both alerts.
what is the correct syntax for this line?
thanks
Jason
"MikeR" <nf4l@xxxxxxxxx> wrote in message news:utYjASgXFHA.1404@xxxxxxxxxxxxxxxxxxxxxxx
if (document.form.Avocado.value) {
document.write("avo>0");
}
evaluates the if as a boolean (true or false). What are your possible values?
If the condition is NOT true, then the action will be as you report. The else clause covers that possibility. If the action were true, then your write statements would display. Despite how you WANT it to work, it follows the rules of logic as defined by the language.
Why the condition isn't true is another issue.
MikeR
cheers wrote:
hi,
thanks
but i do not need the 'else' parts just the 'if' like below. how do i use loads of 'if' but NOT have them nested 'if's
the file is not a htm, html file it is a .js file that is called from a htm file that has
<script language="javascript" src="showorders.js"></script>
in the head part.
if (condition you selected apples) { document.write("apples="+cost); }
if (condition you selected pears) { documents.write("pears="+cost); }
... ... ... ...
if (condition you selected oranges) { documents.write("oranges="+cost); }
<deprez@xxxxxxxxxx> wrote in message news:1116644713.940369.5370@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Here is how I would do it... ----------------------------------- SNIP --------------------------------------- <html> <head> <script> function showorders() {
alert("start of show orders script");
var form = document.favororders;
alert("123456789"); if (form.Avocado.value) { document.write("avo>0"); } else { document.write("avo<=0"); } alert("after the first if in show orders script"); if (form.ButterSquash.value) { document.write("but>0"); } return 0; } </script> <body> Hello
<form name="favororders" id="favororders" action="do.jsp" method="get"> <input type="text" name="Avocado" value="1"> <input type="text" name="ButterSquash" value="1"> <input type="submit" value="Submit"> </form>
<script> document.write("hello<br>"); showorders(); document.write("hello<br>"); </script> </body> </html> -------------------------------------END SNIP---------------------------------------- Hope this helps, Geodepe http://www.digitalorder.com
.
- References:
- my 'if' comands are still not working. please help
- From: cheers
- Re: my 'if' comands are still not working. please help
- From: deprez
- Re: my 'if' comands are still not working. please help
- From: cheers
- Re: my 'if' comands are still not working. please help
- From: MikeR
- Re: my 'if' comands are still not working. please help
- From: cheers
- my 'if' comands are still not working. please help
- Prev by Date: Re: Moved website and now ASP doen't work with access?
- Next by Date: Re: Moved website and now ASP doen't work with access?
- Previous by thread: Re: my 'if' comands are still not working. please help
- Next by thread: Re: my 'if' comands are still not working. please help
- Index(es):