Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple Javascript Question



when you say text field are you refering to an input type text?

if so:

<input type="text" name="box1" id="box1" />

make sure you add a unique id to the input tag, then in javascript

if(document.getElementById('box1').value == "option1") {

} else {

}

On 1/11/07, Mark Delfs <email@hidden> wrote:
How would I do an if-then statement from the contents of a text box on a
widget?

For example, my script runs and populates a text field with the words
"Passed Test" I want to have the widget change a graphic based on what this
text box says---if the contents of that text box say "Passed Test" then I
want to have the widget change the graphic to a green version of the
graphic. Then, if the text box says "Failed Test," I want it to turn the
graphic to a red version. The current line of code will change the graphic
regardless of what the box is saying--I don't have the code at my fingertips
at the moment, but, the rest of the script works great except for when it's
supposed to read a text box, decide what it says and change a graphic
accordingly.

Please help if you can, I'm very new to Javascript!





 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Dashboard-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/dashboard-dev/email@hidden

This email sent to email@hidden


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Dashboard-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/dashboard-dev/email@hidden

This email sent to email@hidden
References: 
 >Simple Javascript Question (From: "Mark Delfs" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.