SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Threaded View

  1. #1
    SitePoint Member
    Join Date
    Apr 2011
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    problem with radio button changing background color

    <HTML>
    <Head>
    <Script Language=JavaScript>

    function change_it()
    {
    var a=document.forms["myForm"]["colorc"].getInputValue

    if(a="blue")
    {
    document.body.style.background=a
    return false;
    }
    else if(a="red")
    {
    document.body.style.background=a
    return false;
    }

    else if(a="yellow")
    {
    document.body.style.background=a
    return false;
    }
    }

    </Script>
    </Head>
    <body>
    <form name="myForm">
    <input type="radio" name="colorc" value="blue">blue <br>
    <input type="radio" name="colorc" value="red">red <br>
    <input type="radio" name="colorc" value="yellow">yellow <br/> <br />

    <input type="button" value="changecolor" name="ChangeColor" onClick="return change_it()"> <br /> <br />
    </form>
    </body>
    </html>

    problem:"it only change background color into blue"
    Last edited by strikefist; Apr 4, 2011 at 17:48. Reason: new


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
  •