IE not implemented error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rhx
    New Member
    • Jul 2007
    • 14

    IE not implemented error

    guys, got this script working fine in FF but not in IE, any idea how to fix this?

    [CODE=javascript] <script type="text/javascript">
    var intcount = 1;
    function addSpecsArea()
    {
    if(intcount >= 5)
    {
    alert("Maximum of 4 fields is allowed.");
    }
    else
    {
    var newInput = document.create Element("textar ea");
    newInput.setAtt ribute("type", "text");
    newInput.setAtt ribute('id','sp ecs[]');
    newInput.setAtt ribute('name',' specs' + intcount);
    newInput.setAtt ribute("cols", "40");
    newInput.setAtt ribute("row", "4");
    newInput.setAtt ribute("class", "box");
    document.getEle mentById("tdToA ddSpecs").appen dChild(newInput );
    intcount++;
    }
    }
    </script>[/CODE]


    [HTML] <td class="content" id="tdToAddSpec s">
    <input type="button" onclick="addSpe csArea()" value="Add Specifications" />
    </td>[/HTML]
  • epots9
    Recognized Expert Top Contributor
    • May 2007
    • 1352

    #2
    Originally posted by rhx
    guys, got this script working fine in FF but not in IE, any idea how to fix this?

    Code:
     <script type="text/javascript">
          var intcount = 1;
          function addSpecsArea()
          {
    		if(intcount >= 5)
    		{
    		alert("Maximum of 4 fields is allowed.");
    		}
    		else
    		{
    			var newInput = document.createElement("textarea");
    			newInput.setAttribute("type", "text");
    			newInput.setAttribute('id','specs[]');
    			newInput.setAttribute('name','specs' + intcount);
    			newInput.setAttribute("cols", "40");
    			newInput.setAttribute("row", "4");
    			newInput.setAttribute("class", "box");
    			document.getElementById("tdToAddSpecs").appendChild(newInput);
    			intcount++;
    		}
    	}
    </script>

    [HTML] <td class="content" id="tdToAddSpec s">
    <input type="button" onclick="addSpe csArea()" value="Add Specifications" />
    </td>[/HTML]
    what is the problem is it the style not working? try this:

    [code=javascript]
    var newInput = document.create Element("textar ea");
    /* textarea does not have an attribute 'type', disabled
    newInput.setAtt ribute("type", "text");*/
    newInput.setAtt ribute('id','sp ecs[]');
    newInput.setAtt ribute('name',' specs' + intcount);
    newInput.setAtt ribute("cols", "40");
    newInput.setAtt ribute("row", "4");
    if(navigator.ap pName == "Microsoft Internet Explorer")
    {
    newInput.setAtt ribute("classNa me", "box");
    }
    else
    {
    newInput.setAtt ribute("class", "box");
    }
    document.getEle mentById("tdToA ddSpecs").appen dChild(newInput );
    intcount++;
    [/code]

    test that out and see if that helps u.
    if there is another problem other than this one...please state what they/all are.

    good luck

    Comment

    • rhx
      New Member
      • Jul 2007
      • 14

      #3
      Originally posted by epots9
      what is the problem is it the style not working? try this:

      [code=javascript]
      var newInput = document.create Element("textar ea");
      /* textarea does not have an attribute 'type', disabled
      newInput.setAtt ribute("type", "text");*/
      newInput.setAtt ribute('id','sp ecs[]');
      newInput.setAtt ribute('name',' specs' + intcount);
      newInput.setAtt ribute("cols", "40");
      newInput.setAtt ribute("row", "4");
      if(navigator.ap pName == "Microsoft Internet Explorer")
      {
      newInput.setAtt ribute("classNa me", "box");
      }
      else
      {
      newInput.setAtt ribute("class", "box");
      }
      document.getEle mentById("tdToA ddSpecs").appen dChild(newInput );
      intcount++;
      [/code]

      test that out and see if that helps u.
      if there is another problem other than this one...please state what they/all are.

      good luck
      thanks a lot epots9, had it working when i removed the type attribute, my problem now is on how to make the new input go below the first textarea, in FF it works ok but in IE the new input appears right after the first input.

      Comment

      • epots9
        Recognized Expert Top Contributor
        • May 2007
        • 1352

        #4
        Originally posted by rhx
        thanks a lot epots9, had it working when i removed the type attribute, my problem now is on how to make the new input go below the first textarea, in FF it works ok but in IE the new input appears right after the first input.
        when u say right after do u mean they are side by side?

        Comment

        • rhx
          New Member
          • Jul 2007
          • 14

          #5
          Originally posted by epots9
          when u say right after do u mean they are side by side?
          yes, and i want the new input to appear below.

          Comment

          • epots9
            Recognized Expert Top Contributor
            • May 2007
            • 1352

            #6
            Originally posted by epots9
            [code=javascript]
            var newInput = document.create Element("textar ea");
            /* textarea does not have an attribute 'type', disabled
            newInput.setAtt ribute("type", "text");*/
            newInput.setAtt ribute('id','sp ecs[]');
            newInput.setAtt ribute('name',' specs' + intcount);
            newInput.setAtt ribute("cols", "40");
            newInput.setAtt ribute("row", "4");
            if(navigator.ap pName == "Microsoft Internet Explorer")
            {
            newInput.setAtt ribute("classNa me", "box");
            }
            else
            {
            newInput.setAtt ribute("class", "box");
            }
            document.getEle mentById("tdToA ddSpecs").appen dChild(newInput );
            //add the following line--------\/\/
            document.getEle mentById("tdToA ddSpecs").appen dChild(document .createElement( "br"));
            //up here ---^^
            intcount++;
            [/code]
            add that line and every new textarea will be at the bottom

            good luck

            Comment

            • rhx
              New Member
              • Jul 2007
              • 14

              #7
              Originally posted by epots9
              add that line and every new textarea will be at the bottom

              good luck
              its now going at the bottom, many thanks epots9.

              just want to ask why do we use "className" for IE instead of "class"?

              Comment

              • iam_clint
                Recognized Expert Top Contributor
                • Jul 2006
                • 1207

                #8
                we use className for firefox and ie... just class doesn't seem to work on much anymore.

                infact this is how i would have done it like this.
                [CODE=javascript]
                newInput.classN ame = "box";
                [/CODE]

                in place of
                [CODE=javascript]
                if(navigator.ap pName == "Microsoft Internet Explorer")
                {
                newInput.setAtt ribute("classNa me", "box");
                }
                else
                {
                newInput.setAtt ribute("class", "box");
                }
                [/CODE]

                no reason for browser detection

                Comment

                • epots9
                  Recognized Expert Top Contributor
                  • May 2007
                  • 1352

                  #9
                  Originally posted by iam_clint
                  we use className for firefox and ie... just class doesn't seem to work on much anymore.

                  infact this is how i would have done it like this.
                  [CODE=javascript]
                  newInput.classN ame = "box";
                  [/CODE]

                  in place of
                  [CODE=javascript]
                  if(navigator.ap pName == "Microsoft Internet Explorer")
                  {
                  newInput.setAtt ribute("classNa me", "box");
                  }
                  else
                  {
                  newInput.setAtt ribute("class", "box");
                  }
                  [/CODE]

                  no reason for browser detection
                  after testing that your right, but if u use setAttribute u have to use class for FF and className in ie.

                  **tested on a valid xhtml transitional page

                  Comment

                  • rhx
                    New Member
                    • Jul 2007
                    • 14

                    #10
                    Originally posted by epots9
                    after testing that your right, but if u use setAttribute u have to use class for FF and className in ie.

                    **tested on a valid xhtml transitional page
                    that's what i observed in setAttribute, using 'class' in IE it does not read the format and needs 'className' to properly display the element. got no problem with FF., thanks a lot, you're a big help epots9.

                    Comment

                    • epots9
                      Recognized Expert Top Contributor
                      • May 2007
                      • 1352

                      #11
                      i'm glad that i could be of assistance.

                      come back anytime whenever u need some help.

                      Comment

                      • Plater
                        Recognized Expert Expert
                        • Apr 2007
                        • 7872

                        #12
                        (nevermind, missed reading something)

                        Comment

                        Working...