473,385 Members | 2,044 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

JavaScript function is working only in FIreFox Not in IE and Safari

3
Hi,

I am using a javascript function for hiding a particular html row while clicking the check box.
Each row corresponds to different checkbox.

The code I have used is:

Expand|Select|Wrap|Line Numbers
  1. <asp:Checkbox ID="chekID_One" onchange="hide_Ctrls('one')" Checked="false" runat="server"></asp:Checkbox>
  2. <asp:Checkbox ID="chekID_Two" onchange="hide_Ctrls('two')" Checked="false" runat="server"></asp:Checkbox>
  3.  
  4. <script language="JavaScript" type="Text/Javascript">
  5. if(value == 'one')
  6. {
  7. var getOne = document.getElementById('chekID_One').checked;    
  8.  
  9. if(getOne == true)
  10. {                
  11. document.getElementById('trOne').style.visibility = "collapse";                
  12. }
  13. else
  14. {
  15. document.getElementById('trOne').style.visibility = "visible";
  16. }
  17. }
  18. </script>
  19.  
This code is working fine in firefox. But not in IE and Safari.
Can anyone tell why is it so???

Plzzz help me...
Jan 25 '08 #1
4 4306
gits
5,390 Expert Mod 4TB
do you get any error message in IE or safari? could you post your hide_Ctrls() function?

ahh ... and i think to hide something you should use 'hidden' as the value for visibility

kind regards
Jan 27 '08 #2
simikc
3
Hi,

No I am not getting any error in IE or Safari. And while using 'hidden' it just make the visibility hidden. The space will be there. Thats why I used 'collapse' which will hide the controls as well as space.
And the hide_Ctrls() function is:

Expand|Select|Wrap|Line Numbers
  1. <script language="JavaScript" type="Text/Javascript">
  2. function hide_Ctrls()
  3. {
  4.     if(value == 'one')
  5.     {
  6.     var getOne = document.getElementById('chekID_One').checked; 
  7.  
  8.     if(getOne == true)
  9.     {            
  10.     document.getElementById('trOne').style.visibility = "collapse";    
  11.     }
  12.     else
  13.     {
  14.     document.getElementById('trOne').style.visibility = "visible";
  15.     }
  16. }
  17. </script>
do you get any error message in IE or safari? could you post your hide_Ctrls() function?

ahh ... and i think to hide something you should use 'hidden' as the value for visibility

kind regards
Jan 28 '08 #3
leoiser
41
hi,

Use Div for it...

javascript
Expand|Select|Wrap|Line Numbers
  1. function hide_Ctrls()
  2. {
  3.  
  4.         var getOne = document.getElementById('chekID_One').checked;
  5.  
  6.         if(getOne == true)
  7.         { 
  8.             alert('divone none');
  9.             document.getElementById('divone').style.display  = 'none'; 
  10.         }
  11.         else
  12.         {
  13.             alert('divone hidden');
  14.             document.getElementById('divone').style.display = '';
  15.         }
  16.  
  17.         getOne = document.getElementById('chekID_Two').checked;        
  18.  
  19.         if(getOne == true)
  20.         { 
  21.             alert('divtwo none');
  22.             document.getElementById('divtwo').style.display  = 'none'; 
  23.         }
  24.         else
  25.         {
  26.             alert('divtwo hidden');
  27.             document.getElementById('divtwo').style.display = '';
  28.         }
  29.  
  30. }
  31.  
  32.  
  33. Question1 <asp:Checkbox ID="chekID_One" onClick="hide_Ctrls('one')" Checked="false" runat="server"></asp:Checkbox>
  34.         <div id='divone'>
  35.             This is the answer of Question1
  36.         </div>
  37.         Question2<asp:Checkbox ID="chekID_Two" onClick="hide_Ctrls('two')" Checked="false" runat="server"></asp:Checkbox>
  38.        <div id='divtwo'>This is the answer of Question2</div>
  39.  

Hope this will help... Thanks
Jan 28 '08 #4
simikc
3
Hi,

Ya its working fine now.

Thanks... :-)


hi,

Use Div for it...

javascript
Expand|Select|Wrap|Line Numbers
  1. function hide_Ctrls()
  2. {
  3.  
  4.         var getOne = document.getElementById('chekID_One').checked;
  5.  
  6.         if(getOne == true)
  7.         { 
  8.             alert('divone none');
  9.             document.getElementById('divone').style.display  = 'none'; 
  10.         }
  11.         else
  12.         {
  13.             alert('divone hidden');
  14.             document.getElementById('divone').style.display = '';
  15.         }
  16.  
  17.         getOne = document.getElementById('chekID_Two').checked;        
  18.  
  19.         if(getOne == true)
  20.         { 
  21.             alert('divtwo none');
  22.             document.getElementById('divtwo').style.display  = 'none'; 
  23.         }
  24.         else
  25.         {
  26.             alert('divtwo hidden');
  27.             document.getElementById('divtwo').style.display = '';
  28.         }
  29.  
  30. }
  31.  
  32.  
  33. Question1 <asp:Checkbox ID="chekID_One" onClick="hide_Ctrls('one')" Checked="false" runat="server"></asp:Checkbox>
  34.         <div id='divone'>
  35.             This is the answer of Question1
  36.         </div>
  37.         Question2<asp:Checkbox ID="chekID_Two" onClick="hide_Ctrls('two')" Checked="false" runat="server"></asp:Checkbox>
  38.        <div id='divtwo'>This is the answer of Question2</div>
  39.  

Hope this will help... Thanks
Jan 28 '08 #5

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

Similar topics

3
by: JB | last post by:
Navigation is not possible on a Mac with Safari/Firefox on: http://www.kerst.karelv.nl/frames/navigatie.html Why does the javascript script not work? -- JB
4
by: Pasquale | last post by:
I am using the function below to add multiple checkbox selection to an array. The form gets submitted to a PHP script. The function works fine with IE 6, Netscape 7 and Firefox 1, but it is not...
6
by: dpodkuik | last post by:
I have a simple function that does submit for me: <script language="javascript" type="text/javascript"> function sort() { //selected item value from the drop down list var...
2
by: drew197 | last post by:
I am a newbie. This is someone else's code which I have to modify to work in Mozilla and Safari. The changes I made so far have allowed it to work in Mozilla but not Safari. It seems to be...
12
by: cewisham | last post by:
I have a menu that pops up different layers as you mouse over. Seems to work OK in IE 6. I position the layers dynamically with javascript because the menu moves when users resize their browser...
2
by: cbjewelz | last post by:
Hey all. So I'm having problems with cross browser alignments. I'm looking at Safari and Mozilla Firefox. I develop in Safari and so it looks perfect there however in Firefox my vertical...
2
by: NickMc71 | last post by:
Hello, I have the following JS code: function MM_load() { var x=document.getElementsByName("newDDL"); for(var i=0;i<=x.length-1;i=i+1) {
1
by: vvcortazar | last post by:
I'm having a problem with some javascript buttons on firefox and safari, the code that is executed is the following: <tr> <td...
2
by: LindaDhasan | last post by:
Hi, I am a beginner with javascript.Please help me clarify how to display the result of a javascript function within html underline tag.PFA the code. <html> <head> <script...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...

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.