473,786 Members | 2,775 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how can I change radio button into image?

Fary4u
273 Contributor
how can i change radio button into image but functionality should be like radio button ?

Expand|Select|Wrap|Line Numbers
  1. .pic
  2. { background:url(pic.jpg) no-repeat; } 
  3. <input type=radio src=pic.jpg value=1 name=1>
  4. or
  5. <input type=radio class=pic value=1 name=1>
  6.  
none of them is working :(
Aug 5 '10 #1
7 4540
Dormilich
8,658 Recognized Expert Moderator Expert
obviously. you can’t apply an image to a radio button.

depending on what you _exactly_ want, I can give you an advice, though.
Aug 5 '10 #2
Fary4u
273 Contributor
trying to replace radio button into image
so it's not look like a radio button
it's only look like a image.

any thought ?
Aug 5 '10 #3
Dormilich
8,658 Recognized Expert Moderator Expert
use an image or an element with background image, and emulate the radio button behaviour by JavaScript.

of course, you will need a fallback, should JavaScript be disabled (e.g. replace the radio button with the image through JS)
Aug 5 '10 #4
Fary4u
273 Contributor
bro is it possible u've got any example in hand ?
Aug 5 '10 #5
Dormilich
8,658 Recognized Expert Moderator Expert
I would have to make up one.
Expand|Select|Wrap|Line Numbers
  1. <!-- I leave the CSS to your imagination -->
  2. <span class="radio"></span>
Expand|Select|Wrap|Line Numbers
  1. // for simplicity, only standard compliant code
  2. // 'span' being a reference to the <span> element
  3. function toggle()
  4. {
  5.     this.checked = !this.checked;
  6.     if (this.checked) {
  7.         this.textContent = "●";
  8.     }
  9.     else {
  10.         this.textContent = "";
  11.     }
  12. }
  13. span.addEventListener("click", toggle, false);
Aug 5 '10 #6
Fary4u
273 Contributor
thxs for the coding works fine,

my coding only work with input element ( checkbox & radio button ) coz it's asp.net funcation using sql query.

i've got 10 different radio buttons & need 2 replace each different images which one is the easy method ?

Expand|Select|Wrap|Line Numbers
  1. <input type=radio value=1 name=red> 
  2. <input type=radio value=1 name=blue> 
  3. <input type=radio value=1 name=green> 
  4. <input type=radio value=1 name=black> 
  5. <input type=radio value=1 name=white> 
  6.  
Aug 5 '10 #7
Dormilich
8,658 Recognized Expert Moderator Expert
that depends on whether you still need the radios.
Aug 5 '10 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

4
3611
by: Ken Fine | last post by:
I've made a content managment system that uses icons to represent page layouts. To choose a different layout, the user clicks on a radio button associated with each layout icon. On click of one of the radio buttons, the form submits and a new layout is chosen. I would prefer if people can click on the icons themselves , rather than using the radio buttons.The border or background associated with the selected icon can highlight...
1
18783
by: Jawahar Rajan | last post by:
All, I am using a few Input type of "Image" instead of a classic submit button in a form to achieve various tasks for example image1 - add user image2 - modify user image3 - delete user image4 - reSet user.
1
4137
by: Brian Genisio | last post by:
Hi all, I noticed that the image input type does not show up in the elements array (IE 6.0). <FORM name=myForm> <INPUT name=rads id=check1 type=radio value=val1> <INPUT name=rads id=check2 type=radio value=val2 checked> <INPUT name=rads id=check3 type=radio value=val3> <INPUT name=rads id=check4 type=radio value=val4>
2
5431
by: Rob | last post by:
Hi all, I've got multiple sets of radio button that are dynamically created in code and populated by a database query. The query returns about 20 recordsets with 3 radio buttons per recordset and I want to be able to retrieve the selected value from each of the sets of radio buttons.The names of each group of radio buttons is set by the database and I don't know how to retrieve the values because I don't know the names of these radio...
1
3325
by: Karthick Kumar | last post by:
Hi, I have the following code which displays all the images from a specific folder with a Radio button in it: Dim objFile i = 1 For Each objFile In objFolder.Files If (i = 1) Then Response.Write("<TR>")
1
1577
by: pierre.basson | last post by:
Hi, I have a DataList that contains an image and 3 radio buttons. The radio buttons are used to change the status of the image i.e. Approved, Suspended and Deleted. When the form loads, I want to set the Radio button to the image's current status. Does anyone know how I can do this? Thanks in advance.
4
4108
by: Samuel R. Neff | last post by:
I have a set of radio buttons in a win form that each have an image and text, like so: O O O O How can I set it up so that the image is left aligned, next to the radio button indicator, and the text is left aligned next to the
1
4085
by: sourcie | last post by:
I am changing an existing quiz found on "JavaScriptKit.com Multiple Choice Quiz" I have an image. Instead of using the radio buttons with the normal true/false question, I want to place two hotspots on the image. One being correct(a) and the other incorrect(b). When the user clicks on the correct hotspot or place on the image, it should score and retain that value until the end of the quiz. At the end of the quiz, there is a submit button...
4
5066
by: rajsrmc | last post by:
In my form i have three radio buttons and nine image buttons, three image buttons per radio buttons If the user check one radio button, the respective three image buttons only has to be displayed. In a single time one radio button only can be checked the rest two would be unchecked Here i have pasted the aspx file design source <%@ Page Language="VB" AutoEventWireup="false" CodeFile="start.aspx.vb" Inherits="start" %> <!DOCTYPE html...
9
2847
by: chabbs | last post by:
Hi, I have my form with some combo box and radio button. And i need to display an image based on the selections. I need to display dynamically the image when the selections are made without any submit button. The image comes from a table where it needs to be retrieved from the selection criteria.
0
9650
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10363
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10164
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
6748
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5398
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4067
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3670
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.