iEntry 10th Anniversary Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > JavaScript

Reply
 
LinkBack Thread Tools
Old March 24th, 2009, 08:18 PM   #1
New Member
 

Join Date: Mar 2009
Location: sheffield
Age: 18
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 liamsorsby is on a distinguished road
Exclamation radio buttons with javascript

i need my ratio buttons, when clicked, to change my main product image. each button changing the main image into a different image. but i'm unable to use the value="" in the input as it has a variable already. i need about 13 ratio buttons.
liamsorsby is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old March 25th, 2009, 07:23 PM   #2
New Member
 

Join Date: Jun 2007
Location: England
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 Captain Logical is on a distinguished road
Re: radio buttons with javascript

Quote:
Originally Posted by liamsorsby View Post
i need my ratio buttons, when clicked, to change my main product image. each button changing the main image into a different image. but i'm unable to use the value="" in the input as it has a variable already. i need about 13 ratio buttons.
Code:
function picFromRadio( imgHolder, imgArray, btnGroup )
{
 for(var i=0, len=btnGroup.length; i<len; i++)
  btnGroup[i].onclick = (function(h, a, idx){ return function(){ h.src = a[idx]; } })(imgHolder, imgArray, i);   
}
The parameters are references to:
  • The image placeholder
  • An array holding the image filenames
  • The group of radio buttons
Call the function anywhere below all the involved elements.
Captain Logical is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks

Tags
javascript , problem , radio button problem


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 On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Radio buttons in AS3 aduchate Flash and ActionScript 4 January 4th, 2009 01:50 PM
disabling radio buttons vapanchamukhi JavaScript 1 October 21st, 2008 06:38 PM
[SOLVED] Help with Radio buttons Oak JavaScript 17 February 2nd, 2008 06:44 AM
Radio Buttons and Javascript activeware JavaScript 6 December 11th, 2007 03:02 PM
Radio Buttons redhead HTML, XHTML and CSS 2 April 12th, 2004 04:00 PM


Search Engine Optimization by vBSEO 3.2.0 RC8