Solved

How to change the color of Radio by selecting the particular Radio button?.

Posted on 2001-08-08
8
222 Views
Last Modified: 2010-04-09
Hi

How to change the color of Radio by selecting the particular button?. it is working in IE but not in Netscape. how to over come this.
1). the default color of Hello radio should be Green
2). and by selecting the Bye button the Hello button color shold be null and Bye       radio should
become Red color

<html><head>                                                                        
<script language="javascript">                                                
function fun()                                                                                                                                        
{

document.all.item("cell1").style.background="#FFFFFF";                                                                                                
document.all.item("cell2").style.background="red";  

}                                                                                                                                                    
function fun1()                                                                                                                                      
{                                                                                                                                                    
document.f1.all.item("cell2").style.background="#FFFFFF";                                                                                                
document.f1.all.item("cell1").style.background="green";                                                                                                  
}                                                                                                                                                    
</script>  
</head>                                                  
<body>                                                    
<form name=f1>                                                                                    
<table>                                                                                    
<tr><td id="cell1" bgcolor=Green>                                                          
<input type = radio name=m1 onclick="fun1()">hello</td>                                            
<td id="cell2" bgcolor="#FFFFFF">                                        
<input type = radio name=m1 onclick="fun()">Bye</td>                                              
</tr></table>
</form></body></html>
0
Comment
Question by:mmsreddy
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 3

Accepted Solution

by:
nzjonboy earned 50 total points
ID: 6366779
try this

<html><head>                                                                        
<script language="javascript">                                                
function fun()                                                                                      
                                                 
{
    if (document.layers) {
        window.document.layers['cell1'].bgColor = "#FFFFFF";
        window.document.layers['cell2'].bgColor = "red";
     }
    else if (document.all) {
        window.document.all['cell1'].style.background = "#FFFFFF";
          window.document.all['cell2'].style.background="red"
     }
}                                                                                                  
                                                 
function fun1()                                                                                    
                                                 
{                                                                                                  
    if (document.layers) {
        window.document.layers['cell2'].bgColor = "#FFFFFF";
        window.document.layers['cell1'].bgColor = "green";
     }
    else if (document.all) {
        window.document.all['cell2'].style.background = "#FFFFFF";
          window.document.all['cell1'].style.background="green"
     }
}    
                                               
</script>  
</head>                                                  
<body>                                                    
<form name=f1>                                                                                    
<table>
<tr><td id="cell1" bgcolor=Green><input type=radio name=m1 onclick="fun1()">hello</td>
<tr><td id="cell2" bgcolor="#FFFFFF"><input type=radio name=m1 onclick="fun()">Bye</td></tr>
</table>
</form></body></html>

nzjonboy
0
 

Author Comment

by:mmsreddy
ID: 6366879
Hi nzjonboy

Not working in Netscape4.7.
0
 

Author Comment

by:mmsreddy
ID: 6366884
Hi nzjonboy

Not working in Netscape4.7.
0
 

Author Comment

by:mmsreddy
ID: 6366903
Hi nzjonboy

Not working in Netscape4.7.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 3

Expert Comment

by:nzjonboy
ID: 6367083
have a look at this http://developer.irt.org/script/1441.htm

may help

nzjonboy
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 6367730
All very nice but the background of a radio in Netscrap 4.x can only be changed by applying hte style inline you have to have it in a layer, and then re-write the layer.

Problem with that is that if you put the radio in a layer it will break the form in Netscrap and you cannot put it a cell because the layer must be absolutely positioned.

Cd&
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 6629487
This question has been abandoned.  I will make a recommendation to the
moderators on its resolution in a week or two.  I appreciate any comments
that would help me to make a recommendation.

Cd&
 
0
 

Expert Comment

by:ComTech
ID: 6687001
I split the question points here, and accepted one on this page.  COBOLdinosaur I will leave you points in a new question in this TA.

Best regards and Happy Holidays,
ComTech
Community Support
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Showing your events from Google Calendar in Google Maps Why? I travel all week and I thought it would be ideal if staff in office knew where I was based on my calendar. (OK real reason: my son wanted to see where I would be working, and I thoug…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
In this tutorial viewers will learn how to define a gradient in CSS. Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Gradient. Define the background as "linear-gradient(to right, #ee3668, black)". Ensure you …
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now