Solved

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

Posted on 2001-08-08
8
227 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:mmsreddy
ID: 6366903
Hi nzjonboy

Not working in Netscape4.7.
0
 
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
In this tutorial viewers will learn how to style transparent/translucent elements using alpha transparency in CSS Start with a normal styled element, such as a div.: Define its "background-color" property as "rgba (255, 255, 255, .5): The numbers in…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

756 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