...

View Full Version : Popup window help



lisa2
06-03-2005, 03:18 PM
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;

}

}

martin_narg
06-03-2005, 03:25 PM
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

vwphillips
06-03-2005, 03:28 PM
It's kind of hard to see what you are wanting to do

I agree

but variations on


http://www.vicsjavascripts.org.uk/PromptConfirmAlert/PromptConfirmAlert.htm

could provide a solution to many input requirement

lisa2
06-03-2005, 04:40 PM
I have print screens on how the popup window is supose to work but I can't post them

lisa2
06-03-2005, 04:46 PM
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

martin_narg
06-03-2005, 05:05 PM
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).



<!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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum