Follow us on...
Follow us on Twitter Follow us on Facebook
Register
Results 1 to 3 of 3
  1. #1
    twister's Avatar
    twister is offline Howdy
    Join Date
    Oct 2000
    Location
    Minneapolis MN
    Posts
    2,519
    Thanks
    0
    Thanked 1 Time in 1 Post

    Question Javascript Help Please

    Can anyone help me? I know PHP but not much javascript but i need some radio button values to change on the fly but don't know how. Here is how it works.

    If the user inputs a number between 0-49 then radio button a is .50 radio button b is .45 and radio button c is .42

    If the user inputs a number between 50-99 then radio button a is .40 radio button b is .38 and radio button c is .33

    If the user inputs a number 100+ then radio button a is .38 radio button b is .35 and radio button c is .30

    That's the general idea. But how i do that? I need to start with an if statement and then re-assign the radio buttons after that but i'm stuck. Can anyone help?

    Thanks

  2. #2
    bootedbear's Avatar
    bootedbear is offline JavaJunkie
    Join Date
    Jul 2002
    Location
    Austin, TX
    Posts
    101
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If you are talking about the text labels for the radio buttons, they're not really part of the radio button and so there's no radio button attribute to change.

    What you can do (modern browsers only) is the place the labels in span tags, give them an id, and then change the contents of the span.

    For example:

    Code:
    <span id="radioLabel1">whatever</span>
    and in the script

    Code:
    document.getElementById( 'radioLabel1' ).innerHTML = 'something new!';
    Is that what you were after?

    If you also need to change the values that get submitted with the form for the radio group, that can be done as well...

    bear

  3. #3
    twister's Avatar
    twister is offline Howdy
    Join Date
    Oct 2000
    Location
    Minneapolis MN
    Posts
    2,519
    Thanks
    0
    Thanked 1 Time in 1 Post
    I kind of got it to work using a dynamic drop down menu script i found. It was confusing but it worked it out. I think. Basically it works like this.

    If you choose to buy 50 widgets you then can get them colored. Red = $.50 or Blue = $.75 or Green = $.88 cents/each

    If you choose to buy 100 widgets then you can get them colored cheaper.
    Red = $.25 or Blue = $.50 or Green = $.70 cents/each

    Get the idea? the more you choose the cheaper the same three options get. And i want that to happen right away, no page refresh.

    Thanks

 

 

Similar Threads

  1. Calling applet functions via JavaScript...
    By lokem in forum Software Programming & Web Scripting
    Replies: 0
    Last Post: May 28th, 2003, 09:07 PM
  2. Browser that shows javascript errors?
    By twister in forum Mac OS X System & Mac Software
    Replies: 3
    Last Post: February 19th, 2003, 10:20 PM
  3. Omniweb updated
    By edX in forum Mac OS X System & Mac Software
    Replies: 1
    Last Post: February 9th, 2003, 10:23 AM
  4. Arg! JavaScript page works in IE, but not Netscape/Mozilla?
    By simX in forum Mac OS X System & Mac Software
    Replies: 3
    Last Post: July 8th, 2002, 07:43 PM
  5. SimX's JavaScript & Frame problem thread, 2
    By fryke in forum Mac OS X System & Mac Software
    Replies: 0
    Last Post: July 8th, 2002, 07:40 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •