www.webdeveloper.com
Results 1 to 5 of 5

Thread: Function for radiobutton works fine in chrome and firefox, but not in IE

Hybrid View

  1. #1
    Join Date
    Aug 2012
    Posts
    6

    Function for radiobutton works fine in chrome and firefox, but not in IE

    My form has four radiobuttons that I covered with images using position:absolute.
    Then i wrote a function saying that if an image was clicked, it should get a border and the radiobutton should be checked.
    It works in chrome and firefox, but in IE nothing happens!
    Does someone know if maybe the code I'm using isn't supported by IE? Or if there's a better solution for replacing a radiobutton with an image?


    I have four radiobuttons that look like this one:
    PHP Code:
    <div class="struktur"><img src="Mallar/Mall1.jpg" id="str1" />
    <input type="radio" name="struktur" value="Ex1" id="radio1" 
    <?php if ($_POST['struktur'] == "Ex1") { echo 'checked="checked"';} ?>>
    </div>

    And the function:
    PHP Code:
    <script type="text/javascript">
    str1.onclick = function () {
    str1.style.border="thick solid #933396";
    str2.style.border="none";
    str3.style.border="none";
    str4.style.border="none";
    radio1.checked=true;
    }
    </script> 

    Help very much appreciated!

  2. #2
    Join Date
    Aug 2012
    Posts
    6

    Ideas anyone?

    Isn't there anyone who has the slightest idea what could cause this problem?

    Thoughts please?

  3. #3
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,259
    Why do you need to use radio buttons if you are just going to cover them up?

    Just set a global (or possibly local, depending up needs) variable to a #
    indicating the last image clicked.

  4. #4
    Join Date
    Aug 2012
    Posts
    6
    Of course! Thank you!!!!! =)

  5. #5
    Join Date
    Dec 2005
    Location
    FL
    Posts
    7,259
    You're most welcome.
    Happy to help.
    Good Luck.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles