Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    May 2005
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Popup window help

    I would like to have a popup window come up when NA is selected from a dropdown list. and I would like it show i.e. Question# and the number of the dropdown box would be dynamic.

    here is my code:

    function createcom(i)
    {


    CalcScore();



    var qcomm;
    if (qcomm == "")
    {
    qcomm = qcomm + "; Q #" + i + ":";
    document.form.txtqcomments.value = qcomm;
    }

    else
    {
    qcomm = qcomm + "; Q #" + i + ":";
    document.form.txtqcomments.value = qcomm;

    }

    }

  • #2
    Regular Coder martin_narg's Avatar
    Join Date
    Jul 2002
    Location
    Chamonix, France
    Posts
    600
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Could you post up the whole page and a bit more information please mate.

    It's kind of hard to see what you are wanting to do ;-)

    Cheers

    m_n
    "Cos it's strange isn't it. You stand in the middle of a library and go 'Aaaaaaaaaaaaaaaaggggggghhhhhhh!'
    and everybody just stares at you. But you do the same in an aeroplane, and everybody joins in."
    -Tommy Cooper

  • #3
    Senior Coder
    Join Date
    Mar 2005
    Location
    Portsmouth UK
    Posts
    4,529
    Thanks
    3
    Thanked 511 Times in 498 Posts
    It's kind of hard to see what you are wanting to do
    I agree

    but variations on


    http://www.vicsjavascripts.org.uk/Pr...nfirmAlert.htm

    could provide a solution to many input requirement

  • #4
    New Coder
    Join Date
    May 2005
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Popup winddow help

    I have print screens on how the popup window is supose to work but I can't post them

  • #5
    New Coder
    Join Date
    May 2005
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    ok here is the drop down, when someone selects N=no or NA, I wanted a popup window that would display the number of the question box(the highlighted number)

    <tr>
    <td><font size="-1" face="verdana">2.</font></td>
    <td><select name="cbots2" onChange="CalcScore()">
    <option selected value=-1>NA</option>
    <option value=1>Y</option>
    <option value=0>N</option>
    </select></td>
    </tr>


    that is were i was trying to get that code to work

  • #6
    Regular Coder martin_narg's Avatar
    Join Date
    Jul 2002
    Location
    Chamonix, France
    Posts
    600
    Thanks
    1
    Thanked 3 Times in 3 Posts
    I think this is what you are looking for mate. Basically it finds the number out of the select box name (which, if named correctly, will also be the number of the question).

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Untitled Document</title>
    <script>
    function CalcScore(objSelect) {
    	if( objSelect.value <= 0 && /([0-9]*)$/gi.test(objSelect.name) )
    		alert( "Question: " + RegExp.$1 );
    }
    </script>
    </head>
    
    <body>
    <form name="frm">
    1. 
    <select name="cbots1" onChange="CalcScore(this)">
    <option selected value=-1>NA</option>
    <option value=1>Y</option>
    <option value=0>N</option>
    </select>
    <br><br>
    2.
    <select name="cbots2" onChange="CalcScore(this)">
    <option selected value=-1>NA</option>
    <option value=1>Y</option>
    <option value=0>N</option>
    </select>
    <br><br>
    3.
    <select name="cbots3" onChange="CalcScore(this)">
    <option selected value=-1>NA</option>
    <option value=1>Y</option>
    <option value=0>N</option>
    </select>
    <br><br>
    4.
    <select name="cbots4" onChange="CalcScore(this)">
    <option selected value=-1>NA</option>
    <option value=1>Y</option>
    <option value=0>N</option>
    </select>
    <br><br>
    5.
    <select name="cbots5" onChange="CalcScore(this)">
    <option selected value=-1>NA</option>
    <option value=1>Y</option>
    <option value=0>N</option>
    </select>
    <br><br>
    6.
    <select name="cbots6" onChange="CalcScore(this)">
    <option selected value=-1>NA</option>
    <option value=1>Y</option>
    <option value=0>N</option>
    </select>
    </form>
    </body>
    </html>
    hope this helps

    m_n
    Last edited by martin_narg; 06-03-2005 at 05:18 PM.
    "Cos it's strange isn't it. You stand in the middle of a library and go 'Aaaaaaaaaaaaaaaaggggggghhhhhhh!'
    and everybody just stares at you. But you do the same in an aeroplane, and everybody joins in."
    -Tommy Cooper


  •  

    Posting Permissions

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