Running javascript on Mozilla 1.0.1

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • skyy
    New Member
    • May 2007
    • 109

    Running javascript on Mozilla 1.0.1

    Hi i got some cgi scripts running on the http server which uses javascript also..

    It works well with ie6.. but when i try it on mozilla, the scripts got no response. Some scripts it gives out error such as "form1 not defined"
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    Originally posted by skyy
    Hi i got some cgi scripts running on the http server which uses javascript also..

    It works well with ie6.. but when i try it on mozilla, the scripts got no response. Some scripts it gives out error such as "form1 not defined"
    please, post some js-code from where the error occurs ... you may also use a firefox and the firebug-extension to debug your scripts ...

    kind regards ....

    Comment

    • skyy
      New Member
      • May 2007
      • 109

      #3
      Originally posted by gits
      please, post some js-code from where the error occurs ... you may also use a firefox and the firebug-extension to debug your scripts ...

      kind regards ....
      Hi... here are the code...

      <SCRIPT language="JavaS cript">function checkChecked() {
      var len = del_frm.element s.length; var index=0;
      for(index=0;ind ex<len;index++)
      { if(del_frm.elem ents[index].name=='select_ file')
      { if(del_frm.elem ents[index].checked==true)
      { confirmSubmit() ; return true;
      }} }
      alert("Please select a file/folder to delete"); location.href=" webfolder.cgi";
      return true;}

      <form name="del_frm" id="del_frm" action="webfold er2.cgi" onsubmit="retur n checkChecked()" method=post>
      <input type="checkbox" name="select_fi le" value="example" id="checkbox">
      </form>


      This checkChecked() js function works well with ie6.. when i try to do it with mozilla 1.0.1 it does not work..
      looking at the javascript console:
      Error : del_frm is not defined

      Any idea?

      Comment

      • drhowarddrfine
        Recognized Expert Expert
        • Sep 2006
        • 7434

        #4
        Might not be a solution but this:
        <SCRIPT language="JavaS cript">
        is supposed to be:
        <script type="text/javascript">

        Comment

        • skyy
          New Member
          • May 2007
          • 109

          #5
          Originally posted by drhowarddrfine
          Might not be a solution but this:
          <SCRIPT language="JavaS cript">
          is supposed to be:
          <script type="text/javascript">

          Thanks... but that is not the problem...

          Comment

          • gits
            Recognized Expert Moderator Expert
            • May 2007
            • 5390

            #6
            hi ... the problem is the reference you use for the form, that is ie-way ... you should always prefer the standard w3c-way to refer to nodes in the document, so try the following:

            [CODE=javascript]
            function checkChecked() {
            // at first include this statement in your script that
            // refers the form the standard-compliant way

            var del_frm = document.getEle mentById('del_f rm');

            // ... your code here
            }
            [/CODE]

            hope this helps ;) and
            kind regards ...

            Comment

            • skyy
              New Member
              • May 2007
              • 109

              #7
              Originally posted by gits
              hi ... the problem is the reference you use for the form, that is ie-way ... you should always prefer the standard w3c-way to refer to nodes in the document, so try the following:

              [CODE=javascript]
              function checkChecked() {
              // at first include this statement in your script that
              // refers the form the standard-compliant way

              var del_frm = document.getEle mentById('del_f rm');

              // ... your code here
              }
              [/CODE]

              hope this helps ;) and
              kind regards ...
              Hi gits.. Thanks alot.. this really helps! Thanks!

              Comment

              • skyy
                New Member
                • May 2007
                • 109

                #8
                I got another weird question...

                when i create a textarea like the code below,

                <textarea rows="5" cols="19" readonly style="color:re d;">C:$ls_dir </textarea>


                ie6 gives me a text area with vertical scroll bar while mozilla give me a horizontal scroll bar. Any way to fix it? Thank!

                Comment

                • gits
                  Recognized Expert Moderator Expert
                  • May 2007
                  • 5390

                  #9
                  Originally posted by skyy
                  I got another weird question...

                  when i create a textarea like the code below,

                  <textarea rows="5" cols="19" readonly style="color:re d;">C:$ls_dir </textarea>


                  ie6 gives me a text area with vertical scroll bar while mozilla give me a horizontal scroll bar. Any way to fix it? Thank!
                  try to set overflow: auto to the style ... then scrollbars appear when they are needed ...

                  kind regards

                  Comment

                  • skyy
                    New Member
                    • May 2007
                    • 109

                    #10
                    Originally posted by gits
                    try to set overflow: auto to the style ... then scrollbars appear when they are needed ...

                    kind regards
                    Hi.. How do you do that? can provide me an example?

                    Thanks!

                    Comment

                    • gits
                      Recognized Expert Moderator Expert
                      • May 2007
                      • 5390

                      #11
                      using your example:

                      [CODE=html]
                      <textarea rows="5" cols="19" readonly style="color:re d; overflow:auto;" >C:$ls_dir</textarea>
                      [/CODE]

                      kind regards ...

                      Comment

                      • skyy
                        New Member
                        • May 2007
                        • 109

                        #12
                        Originally posted by gits
                        using your example:

                        [CODE=html]
                        <textarea rows="5" cols="19" readonly style="color:re d; overflow:auto;" >C:$ls_dir</textarea>
                        [/CODE]

                        kind regards ...
                        Hi thanks for the help. but that doesnt work..

                        I want the textarea to have only vertical scroll bar only for all browser.

                        Tried overflow-y:scroll; overflow-x:hidden..

                        Ie6 works fine but mozilla shows horizontal scroll bar...

                        Comment

                        • gits
                          Recognized Expert Moderator Expert
                          • May 2007
                          • 5390

                          #13
                          Originally posted by skyy
                          Hi thanks for the help. but that doesnt work..

                          I want the textarea to have only vertical scroll bar only for all browser.

                          Tried overflow-y:scroll; overflow-x:hidden..

                          Ie6 works fine but mozilla shows horizontal scroll bar...
                          overflow-x, -y are ie specific .. but have a look at this thread:

                          Comment

                          Working...