There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
access audio avg avg 8 bios blue screen boot bsod computer connection cpu crash css dell desktop dma driver drivers dvd email error excel explorer firefox firefox 3 freeze gimp graphics hard drive hardware hijackthis hjt install internet internet explorer itunes keyboard laptop macro malware monitor motherboard network networking outlook outlook 2003 outlook 2007 outlook express pio problem problems router seo server slow sound sp3 spyware trojan usb video virtumonde virus vista vundo windows windows vista windows xp winxp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
Solved: Active 'Radio Button' Effect


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

 
Thread Tools
TW.87's Avatar
Senior Member with 308 posts.
 
Join Date: Dec 2005
Location: Canberra, Australia
Experience: Intermediate
04-Feb-2007, 06:22 PM #1
Arrow Solved: Active 'Radio Button' Effect
I have some content on a website of mine that features a selection of four 'radio buttons' and related text. As the corresponding content for this 'radio button' field is in the form of a quiz-question, only one of the answers is correct.

Is there a simple script available that would allow, when a user selects the correct 'radio button', the answer to become instantly bold?

For example, should the correct answer be the first 'radio button', and the user select the second 'radio button', nothing should happen. Should the user then select the first 'radio button', the text relating to that radio button should become bold to signal the correct answer. Is this possible?

Any help would be greatly appreciated!
Big-K's Avatar
Distinguished Member with 6,883 posts.
 
Join Date: Nov 2003
Location: Kansas
Experience: Advanced
04-Feb-2007, 09:24 PM #2
apply the onclick event to the correct radio button.

simple example(view source to get the stuff for it):
http://bionichippo.com/scripting/radiotest.htm
TW.87's Avatar
Senior Member with 308 posts.
 
Join Date: Dec 2005
Location: Canberra, Australia
Experience: Intermediate
04-Feb-2007, 09:30 PM #3
Thank you for your reply.

Although the script you provided does work in Firefox, it does not work in Internet Explorer 7. Is there a tweak for it that will enable it to work cross-browser?
Big-K's Avatar
Distinguished Member with 6,883 posts.
 
Join Date: Nov 2003
Location: Kansas
Experience: Advanced
05-Feb-2007, 12:31 AM #4
I forgot that IE dislikes certain lazy methods i sometimes use. Yay for debugging. Here you go, the new functions, you can also get rid of the <style>...</style> bit.

function change(){
var item = document.getElementById('answer');
item.style.fontWeight = 'bold';
}
function unchange(){
var item = document.getElementById('answer');
item.style.fontWeight = 'normal';
}
TW.87's Avatar
Senior Member with 308 posts.
 
Join Date: Dec 2005
Location: Canberra, Australia
Experience: Intermediate
05-Feb-2007, 01:12 AM #5
That's great!

Thank you so much for your help! I really appreciate it.
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 06:04 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.