javascript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • banzegirl2
    New Member
    • Feb 2008
    • 2

    javascript

    Hi Everyone

    PLEASE HELP. Im trying to check if the data in my dropdownlist is selected, using an alert message, but it doesnt seem to be working, please help. Here is my code:

    <script language="javas cript" type="text/javascript">
    function CheckAlert()
    {

    alert(document. getElementsById (("<%=ddlCover. ClientID %>").value));

    alert("Got Here");
    }
    </script>
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by banzegirl2
    Hi Everyone

    PLEASE HELP. Im trying to check if the data in my dropdownlist is selected, using an alert message, but it doesnt seem to be working, please help. Here is my code:

    <script language="javas cript" type="text/javascript">
    function CheckAlert()
    {

    alert(document. getElementsById (("<%=ddlCover. ClientID %>").value));

    alert("Got Here");
    }
    </script>
    Is this a JSP?
    Isn't it supposed to be document.getEle mentById (i.e without the s)?
    Also is value a property of a dropdown?

    Comment

    • banzegirl2
      New Member
      • Feb 2008
      • 2

      #3
      Originally posted by r035198x
      Is this a JSP?
      Isn't it supposed to be document.getEle mentById (i.e without the s)?
      Also is value a property of a dropdown?
      I toook out the 's' and iots now running, but the first dialog box says : 'null'. Then the second dialog box shows message. How can I make it show just the one with the alert message?

      Comment

      • BigDaddyLH
        Recognized Expert Top Contributor
        • Dec 2007
        • 1216

        #4
        Mixing JavaScript and Java always makes my hair stand on end -- how do you test it in isolation? I don't think you can. My advice is to remove the Java from the JavaScript. Pass anything you calculate in Java as a parameter to the JavaScript function. Now your JavaScript function is Java-free and you can debug that portion separately. The only mess will be where you invoke the function. Oh well...

        Comment

        • gaya3
          New Member
          • Aug 2007
          • 184

          #5
          Originally posted by banzegirl2
          Hi Everyone

          PLEASE HELP. Im trying to check if the data in my dropdownlist is selected, using an alert message, but it doesnt seem to be working, please help. Here is my code:

          <script language="javas cript" type="text/javascript">
          function CheckAlert()
          {

          alert(document. getElementsById (("<%=ddlCover. ClientID %>").value));

          alert("Got Here");
          }
          </script>


          Hi,
          wat do u get from "<%=ddlCover.Cl ientID %>" this?
          r u getting as ur expectation?

          -Hamsa

          Comment

          • BigDaddyLH
            Recognized Expert Top Contributor
            • Dec 2007
            • 1216

            #6
            Originally posted by gaya3
            Hi,
            wat do u get from "<%=ddlCover.Cl ientID %>" this?
            r u getting as ur expectation?

            -Hamsa
            Please make an effort to use correct spelling and English.

            Comment

            • SharpDeveloper
              New Member
              • Feb 2008
              • 12

              #7
              Hi
              I hope you are using ASP.NET technology.

              The correct statement would be

              alert(document. getElementById( '<%=ddlCover.Cl ientID %>').value);

              It is document.getEle mentById not document.getEle mentsById

              Hope this helps.

              Originally posted by banzegirl2
              Hi Everyone

              PLEASE HELP. Im trying to check if the data in my dropdownlist is selected, using an alert message, but it doesnt seem to be working, please help. Here is my code:

              <script language="javas cript" type="text/javascript">
              function CheckAlert()
              {

              alert(document. getElementsById (("<%=ddlCover. ClientID %>").value));

              alert("Got Here");
              }
              </script>

              Comment

              Working...