473,659 Members | 2,526 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

3 New Member
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 4323
gits
5,390 Recognized Expert Moderator Expert
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 New Member
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 New Member
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 New Member
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
6446
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
1738
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 working with Safari 125. Is there something I just can't see that would cause this?? Thanks. <!--Begin var submitcntiselect = 0;
6
5271
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 dud=window.document.statusForm.sortByStaff.value; window.document.statusForm.action="status.cfm?sortBy="+dud; window.document.statusForm.method="post";
2
2506
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 getting hung up on the first line of code. I put an alert after that line and I never saw it in Safari but I did see it in Mozilla. Any Thoughts? Thanks, Andrew Here's the code:
12
2270
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 window. In the Firefox or Safari browsers the position of the layers is 0,0 no matter what, right off the bat. Top left corner. Can any one tell me why? Here is my javascript function for positioning the layers. Below that is the URL of the page...
2
17075
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 alignments and div widths are off. It's as if firefox has a different definition of a pixel than safari. Here is the url: http://theprize.chemouni.com/testing.php. When you select the Option from the pull down, the first part of the form appears. Then when...
2
4487
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
1370
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 class="subtitulosAzul"> ESTADO DE CUENTA </td> </tr> ...
2
11649
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 type="text/javascript"> function whichBrs() {
0
8428
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
8341
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
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
8751
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
8630
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7360
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2759
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
1739
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.