RonMcIntire
01-17-2009, 06:14 PM
I am trying to write a snippet to put in my form and cannot get it to run. Can anyone see what's wrong? I keep getting an undefined error for the variable 'Code' no matter what I do.
The goal is present obtain a Time Frame based on an SVCode selected from a group of radio buttons.
Thanks. Ron
<html>
<head>
<script language="text/javascript">
var SV01="";
var SV02="";
var SV03="";
var SV04="";
var DelTime="test";
var code="SV03";
function getDelTime(code)
{
if (code==SV01) { DelTime="8A-5P: 8 Hour Window" }
else
if (code==SV02) { DelTime="8A-8P: 4 Hour Window" }
else
if (code==SV03) { DelTime="8A-8P: 2 Hour Window" }
else
if (code==SV04) { DelTime="8A-8P: 1 Hour Window" }
return (DelTime);
}
</script>
</head>
<body>
<form>
<tr>
<td
valign="top" align="left" bgcolor="#FFCCFF" colspan="2" width="143" height="22">
<p align="left"><em style="font-style: normal; font-weight:700"><font color="#FF0000">*</font>
Time Frame:</em>
</td>
<td
valign="top" align="left" bgcolor="#FFCCFF" colspan="2" width="609" height="22">
<p style="margin-top: 0; margin-bottom: 0"><b>Select a type of Valentine:</b></p>
<p style="margin-top: 0; margin-bottom: 0">
<input type="radio" name="DelCode" value="SV01" LANGUAGE="javascript" DelTime="getDelTime(DelCode)" document.write(code);> 8A-5P: 8 Hour Window ($50)</p>
<p style="margin-top: 0; margin-bottom: 0">
<input type="radio" name="DelCode" value="SV02" LANGUAGE="javascript" DelTime="getDelTime(DelCode)"> 8A-8P: 4 Hour Window ($60)</p>
<p style="margin-top: 0; margin-bottom: 0">
<input type="radio" name="DelCode" value="SV03" LANGUAGE="javascript" DelTime="getDelTime(DelCode)"> 8A-8P: 2 Hour Window ($75)</p>
<p style="margin-top: 0; margin-bottom: 0">
<input type="radio" name="DelCode" value="SV04" LANGUAGE="javascript" DelTime="getDelTime(DelCode)"> 8A-8P: 1 Hour Window ($95)</p>
</td>
</tr>
<input type="button"
onclick=document.write(code);
value="Call function">
</form>
</body>
</html>
The goal is present obtain a Time Frame based on an SVCode selected from a group of radio buttons.
Thanks. Ron
<html>
<head>
<script language="text/javascript">
var SV01="";
var SV02="";
var SV03="";
var SV04="";
var DelTime="test";
var code="SV03";
function getDelTime(code)
{
if (code==SV01) { DelTime="8A-5P: 8 Hour Window" }
else
if (code==SV02) { DelTime="8A-8P: 4 Hour Window" }
else
if (code==SV03) { DelTime="8A-8P: 2 Hour Window" }
else
if (code==SV04) { DelTime="8A-8P: 1 Hour Window" }
return (DelTime);
}
</script>
</head>
<body>
<form>
<tr>
<td
valign="top" align="left" bgcolor="#FFCCFF" colspan="2" width="143" height="22">
<p align="left"><em style="font-style: normal; font-weight:700"><font color="#FF0000">*</font>
Time Frame:</em>
</td>
<td
valign="top" align="left" bgcolor="#FFCCFF" colspan="2" width="609" height="22">
<p style="margin-top: 0; margin-bottom: 0"><b>Select a type of Valentine:</b></p>
<p style="margin-top: 0; margin-bottom: 0">
<input type="radio" name="DelCode" value="SV01" LANGUAGE="javascript" DelTime="getDelTime(DelCode)" document.write(code);> 8A-5P: 8 Hour Window ($50)</p>
<p style="margin-top: 0; margin-bottom: 0">
<input type="radio" name="DelCode" value="SV02" LANGUAGE="javascript" DelTime="getDelTime(DelCode)"> 8A-8P: 4 Hour Window ($60)</p>
<p style="margin-top: 0; margin-bottom: 0">
<input type="radio" name="DelCode" value="SV03" LANGUAGE="javascript" DelTime="getDelTime(DelCode)"> 8A-8P: 2 Hour Window ($75)</p>
<p style="margin-top: 0; margin-bottom: 0">
<input type="radio" name="DelCode" value="SV04" LANGUAGE="javascript" DelTime="getDelTime(DelCode)"> 8A-8P: 1 Hour Window ($95)</p>
</td>
</tr>
<input type="button"
onclick=document.write(code);
value="Call function">
</form>
</body>
</html>