/    Sign up×
Community /Pin to ProfileBookmark

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:

[code=php]
<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>
[/code]

And the function:

[code=php]
<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>
[/code]

Help very much appreciated!

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@KossaMuuauthorApr 21.2013 — Isn't there anyone who has the slightest idea what could cause this problem?

Thoughts please?
Copy linkTweet thisAlerts:
@JMRKERApr 22.2013 — 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.
Copy linkTweet thisAlerts:
@KossaMuuauthorApr 22.2013 — Of course! Thank you!!!!! =)
Copy linkTweet thisAlerts:
@JMRKERApr 22.2013 — You're most welcome.

Happy to help.

Good Luck.

?
×

Success!

Help @KossaMuu spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...