SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Jun 2010
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need help with a JS bug

    Im styling radioboxes with CIRC when I run the script locally I get not error at all...

    but when I apply the script to my code on my webserver the radioboxes stops workings and I get this error in firebug

    arrInputs[i].getAttributeNode("type") is null
    [Break on this error] inputElementType = arrInputs[i].getAttributeNode('type').value;

    http://www.micr0softs.com/cf/

    anyone would have an idea what could cause the script to bork when on my web server?

    Thanks a lot

  2. #2
    SitePoint Enthusiast
    Join Date
    Apr 2009
    Posts
    73
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sometimes when uploading content to remote servers the content can be cached...check the source and compare it to your working copy to make sure it hasn't cached the files.

    Other than that, i've checked the site in IE7 and am getting a different error:

    Message: 'clickedLabelElement' is null or not an object
    Line: 113
    Char: 4
    Code: 0
    URI: http://www.micr0softs.com/cf/crir/crir.js

  3. #3
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    16,498
    Mentioned
    164 Post(s)
    Tagged
    1 Thread(s)
    Two things that I see that might be doing it.

    Not all of the attribute values are inside of quotes.
    Not every input has a type attribute.

  4. #4
    SitePoint Member
    Join Date
    Jun 2010
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks both for replies I will check the hints and get back to you guys on that

  5. #5
    SitePoint Member
    Join Date
    Jun 2010
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The code if half working now the html output version on

    http://www.micr0softs.com/cf/index.html

    but not working on the php version... wich is weird since its the same exact code..... -___-

  6. #6
    SitePoint Member
    Join Date
    Jun 2010
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Still bugged out this part of the script is the problem to be EXACT

    Code:
    	arrsInputs = document.getElementsByTagName("input");
    	
    		// uncheck (label class) all radios in the same group
    		for (var i=0; i<arrsInputs.length; i++) {	
    			inputElementType = inputElement.getAttributeNode('type').value;
    			if (inputElementType == 'radio') {
    		
    				inputElementName = arrsInputs[i].getAttribute('Name').value;
    				inputElementClass = arrsInputs[i].className;
    				// find radio buttons with the same 'name' as the one we've changed and have a class of chkHidden
    				// and then set them to unchecked
    				if (inputElementName == clickedInputElementName && inputElementClass == 'crirHidden') {				
    					inputElementID = arrsInputs[i].getAttributeNode('id').value;
    					labelElement = crir.findLabel(inputElementID);
    					labelElement.className = 'radio_unchecked';
    				}
    			}
    		}
    Code:
    		inputElementName = arrsInputs[i].getAttribute('Name').value;
    This is where everything goes wrong
    the array
    arrsInputs = document.getElementsByTagName("input");
    arrsInputs.length return a number of 65 inputs wich is correct for my page
    then
    if (inputElementType == 'radio') {
    is getting excuted properly its when im trying to retreive the name of this input with

    Code:
    inputElementName = arrsInputs[i].getAttribute('Name').value;
    its as if arrsInputs[i] is empty and no name is set I also tried to
    inputName = arrsInputs[i]

    then use
    inputName.getAttribute('Name').value;
    no result :S

  7. #7
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,527
    Mentioned
    84 Post(s)
    Tagged
    4 Thread(s)
    The name is just a string, there is no value properly on the name.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •