Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Mozilla firefox issue.

Mozilla firefox issue.

Scheduled Pinned Locked Moved ASP.NET
helpcsharpjavascriptasp-netbusiness
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Ridge Howison
    wrote on last edited by
    #1

    Hello, Thank you for reading this post. I am new to Javascript and ASP.NET development so please bear with me. I have a page that renders fine in IE but the same functionality gives me error in Firefox. I have a form which has a bunch of check boxes and there is a a particular checkbox lets call it ABC, and clicking on it, it needs to uncheck the other boxes, and if other check box is clicked, it shud uncheck the the ABC checkbox. My app works fine in IE but not in Firefox. I know there are a few keywords that is Microsoft proprietary, and is not all browser friendly, but i cannot figure out how to change it. Here is my code below. All help is appreciated. function ValidateCheckedValues( ctrl , isChecked ) { // Purpose : This function is called when the user clicks on any checkbox in the equipment requirements table on the page // If the user clicks on the "ABC" checkbox it clears all the check boxes for that meeting, // but if the user checked any other checkbox, it removes the check from the "ABC" checkbox try { if( ctrl.parentElement.attributes("SubCode").value == "NONE" ) { if( isChecked ) { for( counter = 3 ; counter < ctrl.parentElement.parentElement.parentElement.children.length ; counter++ ) { ctrl.parentElement.parentElement.parentElement.children( counter ).children( 0 ).children( 0 ).checked = false; } ctrl.checked = true; } } else { if( isChecked ) { for( counter = 3 ; counter < ctrl.parentElement.parentElement.parentElement.children.length ; counter++ ) { if( ctrl.parentElement.parentElement.parentElement.children( counter ).children( 0 ).attributes("SubCode").value == "NONE" ) { ctrl.parentElement.parentElement.parentElement.children( counter ).children( 0 ).children( 0 ).checked = false; } } } } } catch( ex ) { alert( ex.message ); } }

    C S 2 Replies Last reply
    0
    • R Ridge Howison

      Hello, Thank you for reading this post. I am new to Javascript and ASP.NET development so please bear with me. I have a page that renders fine in IE but the same functionality gives me error in Firefox. I have a form which has a bunch of check boxes and there is a a particular checkbox lets call it ABC, and clicking on it, it needs to uncheck the other boxes, and if other check box is clicked, it shud uncheck the the ABC checkbox. My app works fine in IE but not in Firefox. I know there are a few keywords that is Microsoft proprietary, and is not all browser friendly, but i cannot figure out how to change it. Here is my code below. All help is appreciated. function ValidateCheckedValues( ctrl , isChecked ) { // Purpose : This function is called when the user clicks on any checkbox in the equipment requirements table on the page // If the user clicks on the "ABC" checkbox it clears all the check boxes for that meeting, // but if the user checked any other checkbox, it removes the check from the "ABC" checkbox try { if( ctrl.parentElement.attributes("SubCode").value == "NONE" ) { if( isChecked ) { for( counter = 3 ; counter < ctrl.parentElement.parentElement.parentElement.children.length ; counter++ ) { ctrl.parentElement.parentElement.parentElement.children( counter ).children( 0 ).children( 0 ).checked = false; } ctrl.checked = true; } } else { if( isChecked ) { for( counter = 3 ; counter < ctrl.parentElement.parentElement.parentElement.children.length ; counter++ ) { if( ctrl.parentElement.parentElement.parentElement.children( counter ).children( 0 ).attributes("SubCode").value == "NONE" ) { ctrl.parentElement.parentElement.parentElement.children( counter ).children( 0 ).children( 0 ).checked = false; } } } } } catch( ex ) { alert( ex.message ); } }

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      what is the error ?

      Christian Graus Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.

      R 1 Reply Last reply
      0
      • C Christian Graus

        what is the error ?

        Christian Graus Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.

        R Offline
        R Offline
        Ridge Howison
        wrote on last edited by
        #3

        please note:this works fine in IE but throws errors like ctrl.parentElement has no properties.Please let me know what error is happening here. I changed the parentElement to parentNode and the children to childNodes but it just will not work for firefox. Iam a Software support person so do not have an indepth handle on the workings of .NET or Javascript. Thank you.

        C 1 Reply Last reply
        0
        • R Ridge Howison

          please note:this works fine in IE but throws errors like ctrl.parentElement has no properties.Please let me know what error is happening here. I changed the parentElement to parentNode and the children to childNodes but it just will not work for firefox. Iam a Software support person so do not have an indepth handle on the workings of .NET or Javascript. Thank you.

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          "ctrl.parentElement.parentElement.parentElement" Code like this is very bad. It assumes that the ctrl has 3 parents and will crash if it does not. If your problem is in Firefox, you should download Firebug, which will let you debug your javascript inside firefox and see exactly what properties are present and what their values are.

          Ridge Howison wrote:

          so do not have an indepth handle on the workings of .NET or Javascript

          Then you're the wrong person for this job, why are you doing it ? Why did my answer get voted as bad ?

          Christian Graus Please read this if you don't understand the answer I've given you. If you're still stuck, ask me for more information.

          1 Reply Last reply
          0
          • R Ridge Howison

            Hello, Thank you for reading this post. I am new to Javascript and ASP.NET development so please bear with me. I have a page that renders fine in IE but the same functionality gives me error in Firefox. I have a form which has a bunch of check boxes and there is a a particular checkbox lets call it ABC, and clicking on it, it needs to uncheck the other boxes, and if other check box is clicked, it shud uncheck the the ABC checkbox. My app works fine in IE but not in Firefox. I know there are a few keywords that is Microsoft proprietary, and is not all browser friendly, but i cannot figure out how to change it. Here is my code below. All help is appreciated. function ValidateCheckedValues( ctrl , isChecked ) { // Purpose : This function is called when the user clicks on any checkbox in the equipment requirements table on the page // If the user clicks on the "ABC" checkbox it clears all the check boxes for that meeting, // but if the user checked any other checkbox, it removes the check from the "ABC" checkbox try { if( ctrl.parentElement.attributes("SubCode").value == "NONE" ) { if( isChecked ) { for( counter = 3 ; counter < ctrl.parentElement.parentElement.parentElement.children.length ; counter++ ) { ctrl.parentElement.parentElement.parentElement.children( counter ).children( 0 ).children( 0 ).checked = false; } ctrl.checked = true; } } else { if( isChecked ) { for( counter = 3 ; counter < ctrl.parentElement.parentElement.parentElement.children.length ; counter++ ) { if( ctrl.parentElement.parentElement.parentElement.children( counter ).children( 0 ).attributes("SubCode").value == "NONE" ) { ctrl.parentElement.parentElement.parentElement.children( counter ).children( 0 ).children( 0 ).checked = false; } } } } } catch( ex ) { alert( ex.message ); } }

            S Offline
            S Offline
            Shog9 0
            wrote on last edited by
            #5
            1. parentElement should be parentNode[^] 2) IE tends to not insert text nodes for whitespace in the HTML; Firefox does. This doesn't normally make any difference, but your code is making some very specific assumptions as to how many children certain elements will have... this is probably going to trip you up sooner or later. Stop it. Either give the target elements ids and use document.getElementById()[^] to retrieve them, or get a library like jQuery[^] to help you traverse the DOM in a safe, sane manner.

            Citizen 20.1.01

            'The question is,' said Humpty Dumpty, 'which is to be master - that's all.'

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups