Swap Image On Radio Button Selection

May 23, 2010

I load a page with two default images and two radio buttons not selected. When either of the radio buttons gets checked I need to swap corresponding image. I tried this but it does not seem to work:

PHP Code:
<html>
<head>
<title>Untitled</title>
<script language="JavaScript">

function swapImage(currencyflag) {
switch (aspectflag) {
case "3x2":
3:2.src = "/i/misc/aspect3x2_rd.png";
16:9.src = "/i/misc/aspect16:9_gr.png";
case "16:9":
3:2.src = "/i/misc/aspect3x2_gr.png";
16:9.src = "/i/misc/aspect16:9_rd.png";
}}
</script>
</head>

<body>
<img src="/i/aspect3x2_gr.png" width="150" height="100" alt="" name="2x3">
<img src="/i/aspect16x9_gr.png" width="178" height="100" alt="" name="16x9">

<form>
<input type="Radio" name="aspect" id="3x2" onclick="swapImage(3x2)">
<input type="Radio" name="aspect" id="16x9" onclick="swapImage(16x9)">

</form>
</body>
</html>

View 2 Replies


ADVERTISEMENT

JQuery :: Pass Radio Button Selection To Hidden Div And Then Show Div List From Chosen Radio Button?

Mar 16, 2010

I am a PHP programmer and new to Javascript and jQuery and I have tried about 20 examples/tutorials and cannot seem to get even close to what I want.I have a form (PHP/MySQL) with a list of subjects I got from my database, and then create a set of radio buttons from that list. And based on what radio button they select, I need to pass that variable to a div (at least that's what I want to use) and then show a list of videos that match the radio buttons value. I don't care if its a get or post or other.I tried to use GET or POST so I can use that value for my PHP/MySQL lists.I am open to any suggestions/tutorials, etc.

View 1 Replies View Related

Link To Reflect Radio Button Selection?

Jun 27, 2010

I am trying to get a css-styled button to stay on its 'roll-over' state once it has been selected by its corresponding radio button (connected via the label tag). So far, I have no idea what I'm doing.

Here's what I have so far: [URL]

This is what it's doing: [URL]

This is what I'd like it to do: [URL]

Any experts out there that can lend a hand ?

View 3 Replies View Related

Form Action Url Selection On Radio Button Value

Jul 5, 2005

I have 2 radio button first is a and second is b.

If a is selected then the form action should be a.php or b is selected then b.php.

Any idea how to do this. I don't want to this in server side script.

View 3 Replies View Related

Show Dynamic List With PHP Using A Radio Button Selection

Mar 15, 2010

I have a form with a list of subjects (radio buttons) that I get from my database with PHP, and I want to show a list of videos (also from my video table using PHP), based on which subject they choose.

I have tried multiple POST, GET methods with JavaScript examples, but cannot get it to work. I am not having any issues with the PHP getting either list, it is just getting the radio buttons to pass either the POST or GET data to JavaScript, and have it take that value so I can get the list from my database with PHP. I tried to use a div for the list of videos, and didn't have much success.

View 6 Replies View Related

Populate Textarea Based On Radio Button Selection?

Aug 24, 2010

how to get contents into a textarea based on a radio button selection.

Code:
<script>
text = new Array()
text[0] = Array('Saab','Volvo','BMW');
text[1] = 'second list';

[Code]....

View 3 Replies View Related

JQuery :: Show / Hide A <div> When Changing The Selection Of A Radio Button?

Mar 2, 2010

I want that a <div> element will show when yes is selected and when no it should be hidden. For show and hind i will use the functions from the jQuery UI. But I don't find a way to call the hide / show function when the selection change.

The radio selection: <input type="radio" name="lang_anz" value="1"> Yes<br> <input type="radio" name="lang_anz" value="0" checked="checked"> No<br> When I understand the documentation I can request the current value from the radio with: <script type="javascript"> $('input:radio[name=lang_anz]:checked').val(); </script>But how i can now call the show / hide function when I change the selection?

View 1 Replies View Related

Display Results Based On Radio Button Selection Without Browser Refresh

Apr 27, 2011

I am very inexperienced with javasciprt. I am designing a form in coldfusion, and want some dynamic action to take place. My users will be offered 2 selections via radio buttons. Depending on which radio button they select, they will get a few more radio buttons to choose from. I have been told that this can be handled in javascript. So I am appealing to the javascript programmer nation for some assistance in this endeavor.

View 6 Replies View Related

Show / Hide Form Fields Depending On Radio Button Selection

May 29, 2005

How to show and hide form fields depending on a selected radio button.

View 14 Replies View Related

Radio Buttons - Get The Image To Display Whenthey Click On The Radio Button

Feb 28, 2010

Im trying to configuere a form that a.a radio buttons that allow the user to choose between quarters, nickels, dimes and pennies and show image when click on my radio button.how to get the image to display whenthey click on the radio button?

View 3 Replies View Related

JQuery :: Disable Button And Swap Out Image

Jan 25, 2010

How to disablea buttonon page load (not an actual submit button -- an image that's hyperlinked) and then enable it and swap out the image once the "next" button is clicked?

View 1 Replies View Related

When Pressing "back" In A Web Browser, Radio Button Selection Is Still Retained

Aug 3, 2010

I have a page where you select a radio button and submit to get certain results. When pressing the back button to get back to the original search page, however, the radio button is still selected, but the page lists it's value as undefined. I wish to do one of the following:

1) assign the radio button's value to what it is actually showing

2) clear out all selections

Here is some relevant code:

Code:
function PageLoad()
{
document.all.item("radioSearch").value = 0;
alert(document.all.item("radioSearch").value)

[Code].....

View 4 Replies View Related

Radio Button Selection Not Made Even Though It Is Made

Aug 19, 2011

Why is the input type = radio on this page is not getting the value assigned to it after the user clicks on the related selection? Here is the page under development: dreamdates.com - TOTALLY FREE online dating service - You can see this by selecting a choice for "I am a: " Radio button selection. I have set up Javascript code, alert, which will tell you that that selection is "Undefined" even though you have selected male or female.

View 4 Replies View Related

Onclick With Radio Button And Image?

Mar 22, 2011

I just started my javascript class two weeks ago and am having troubles already and my book is no help.

My first assignment is having a list of country names and when you click the radio button next to the name the country flag pops up in a designated area for the image. I have tried a few different things but nothing is working. I have the list of countrys and the radio buttons but when i click the radio button the image doesn't pop up. Also, when i click another radio button they all stay selected.

View 5 Replies View Related

Multiple Radio Button Display One Image?

Sep 27, 2010

I need a script that will allow a user to select a vertical selection and Horizontal selection that displays a corresponding image. There are only 8 combinations (4 vertical choices and 2 horizontal choices) I just need to display the correct image and a description. There has to be only one of each selected and only display one image.[URl]..

View 4 Replies View Related

Select A Radio Button By Clicking An Image

Aug 28, 2006

I have a form that shows some images with a radio button associated with each one. I would like to give them the option to click on the image to select the radio, but not sure the easiest way to pull it off.

I was assuming I add a OnClick to each image and use getelementbyid to check the button, but since all the radiobuttons have the same id (so they can only choose one) I am not sure how to make the correct radiobutton become checked.

Hope this makes sense, here is the simplified sample form:

<form>
<img src="image1.gif" />
<input id="radiobutton" type="radio" value="Image1" />
<img src="image2.gif" />
<input id="radiobutton" type="radio" value="Image2" />
<img src="image3.gif" />
<input id="radiobutton" type="radio" value="Image3" />
<img src="image4.gif" />
<input id="radiobutton" type="radio" value="Image4" />
</form>

View 2 Replies View Related

Have A Radio Button - When Selected - Insert An Image Into A Table?

May 26, 2010

Is is possible to have a Radio button, when selected, insert an image into a table(or something)? Each Radio button changing the previous image. I figure it would be an array, or maybe its a simple onclick, both of which I've tried, but I am fairly new to this. I'll show you the code, and hopefully you can figure out what I mean.

[Code]....

View 7 Replies View Related

Pass The Image Attached To The Radio Button From Giftcards.asp To Giftcert.asp?

Jul 21, 2010

i have a form giftcert.html -that has text input boxes the user fills in and a link to the next page for the user to pick a gift card giftcards.asp -the user picks a gift card by radio buttons (over 100)grouped by name and then pushes a button to take them to the next page passing the value of the radio and image (here is the issue) giftcert.asp -this page displays the text boxes from the first page with the value already present (used asp to achieve) and the value of the radio button (a stock number - used asp to achieve) and i want a sample of the image attached to the stock number. how do i pass the image attached to the radio button from giftcards.asp to giftcert.asp i don't know where i am going wrong

a) how do i attach the image to the button do i use an onclick="pass src" and how
b) how do i get the image to show up in giftcert.asp

View 11 Replies View Related

Load Image On Radio Button Click - Without Reloading Page

Apr 28, 2011

I'm trying to make it so that when a user clicks on a radio button, the image that is related to the radio button is displayed next to it (without reloading the page). At the moment all it shows is the image related to the currently saved option, which I'd like to keep on page load. Is this possible?

Here is my code for the radio buttons.

View 3 Replies View Related

Creating Javascript Function To Swap Radio Values

Mar 1, 2006

i am having a problem creating a javascript function to swap my radio values based on the first set one.

i have a bunch of radio buttons on the page which are like this:

Code:
<input type="radio" name="add_id[1]" value="yes" CHECKED>Yes <input type="radio" name="add_id[1]" value="no">No
<input type="radio" name="add_id[2]" value="yes" CHECKED>Yes <input type="radio" name="add_id[2]" value="no">No

etc.... and each one is different, related to an input field, and as you can see it is a radio input array, and all radio inputs are named add_id[1], add_id[2], add_id[3] and so on i want a javascript function that will swap all the values of these radio buttons to whatever the first on is set to, either 'yes' or 'no' Code:

View 3 Replies View Related

Radio Buton Hover Css - Background Color Only Draws A Box Around The Radio Button But Does Not The Actual Radio Color

Mar 24, 2010

l need to apply a hover css on a radio button. Currently the background color only draws a box around the radio button but does not the actual radio color. l dont mind if there is no css even javascript will do

View 1 Replies View Related

Swap URL On Image Swap

Mar 28, 2011

I am a complete novice with Javascript, but am trying to work out how I can get a button to swap to another image when clicked, and each image have a different URL attached. I want to use this to toggle the bgcolor of my page using this script:

Code:
<script type="text/javascript">
<!--
function createCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString();
[Code]...

View 1 Replies View Related

Clicking Radio Button Selects A Second Radio Button?

Feb 24, 2009

Need a script which selects a second radio button when the first radio button in the pair is clicked with the second button greyed/disable but still displaying the selection.

(Hoping to keep the input 'name' the same too if possible - maybe they can be differentiate by 'id' for the script ?)

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>

[Code].....

View 11 Replies View Related

Nesting Onclick Image Swap Events And Image Mapping

Jul 24, 2009

I am trying to make a point and click javascript game. Basically what I want is to have one image displayed on screen at the start (room1.jpg). When you click on a door on that image, I have an onclick event to change the image to a new one that shows the door open (room1_a.jpg). What I want is that when you click the now open door, to display the next room in the game. The only solution I can think of is some sort of nested onclick event using several image maps, but I am fairly new to Javascript and I am not sure if that is possible. What it all comes down to is I want to display each incarnation of each room in the game in the same window without having to reload a new window for each room. I hope that makes sense, if not I can try and clarify. Below is the code I have so far. And as you can see all that does is display the open door when you click on the image. I have not done any of the image mapping yet.

[Code]...

View 2 Replies View Related

Image Swap - Thumbnail The Larger Image Will Go Into The Viewing Area

Jan 14, 2009

I am trying to put together a purse shopping site - I would like to have the various views of the same purse in thumbnails under one image then when the customer clicks on the thumbnail the larger image will go into the viewing area. The general layout is like this page - [URL] So when someone clicks on the smallest image I would like it to replace the other image on the page and the larger image becomes the thumbnail. How is this accomplished?

View 2 Replies View Related

Image Swap OnClick Opens Image In Parent Window

Jul 26, 2010

I'm trying to use javascript to load an image on a webpage when another image is clicked on, just like an image gallery and just like this except I don't need any text: [URL] I copied the example above but when I click on the smaller image to load the larger one it works for a fraction of a second (I can see the image load in the right spot), but then the browser goes to the URL of the image instead (showing it on a blank page).

[Code]....

View 13 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved