belord
06-06-2005, 05:27 PM
Hi,
i have 2 radio buttons called certified and non certified
when you select certified you see a div which has 5 radio buttons like
student
international
professional
married partner
life member
so when you select for example student you see a div pop up ok i want to transfer the value of student radio button in this div
i am stuck on it
it gives me an error which says value is null or not an object which is this line
the_style.innerHTML = todisplay.value;
i had put an alert to see the value it comes as undefined
please help
thanks,
belord
<%
Option Explicit
Dim ReserveDisplay
ReserveDisplay = "none"
%>
<head>
<title>Membership Application</title>
<script type="text/javascript">
<!--
function changeDiv(the_div,the_change,todisplay)
{
var the_style = getStyleObject(the_div);
alert(todisplay);
if (the_style != false)
{
the_style.display = the_change;
the_style.innerHTML = todisplay.value;
}
}
function hideAll()
{
changeDiv("reserve1", "none");
}
function hideAll1()
{
changeDiv("reserve", "none");
changeDiv("reserve2", "none");
}
function getStyleObject(objectId)
{
if (document.getElementById && document.getElementById(objectId))
{
return document.getElementById(objectId).style;
}
else if (document.all && document.all(objectId))
{
return document.all(objectId).style;
}
else
{
return false;
}
}
function blankall()
{
document.frm1.nscacertificate.checked = false;
document.frm1.nscalapelpin.checked = false;
}
function blankall1()
{
document.frm1.nonone.checked = false;
}
function blankall2()
{
document.frm1.nonone.checked = false;
}
//-->
</script>
</head>
<body>
<div class="content">
<form name="frm1">
<h1 id="text">Membership Application</h1>
<fieldset>
<legend>Membership Options</legend>
<!--this field is used to get the gender of the customer-->
<input type="radio" name="memberopt" id="memberopt" value="Certified" onclick="hideAll(); changeDiv('reserve', 'block');" /> <label for="memberopt" class="plain">Certified</label>
<input type="radio" name="memberopt" id="memberopt" value="Non-Certified" onclick="hideAll1(); changeDiv('reserve1', 'block');" /> <label for="memberopt" class="plain">Non-Certified</label></p>
</fieldset>
<div id="reserve" style="display: <%=ReserveDisplay%>;">
<fieldset>
<legend>Certified Member Options</legend>
<input type="radio" name="certopt" id="certopt" value="Professional" onclick="hideAll(); changeDiv('reserve2', 'block', this); " /> <label for="Gender1" class="plain">Professional</label>
<input type="radio" name="certopt" id="certopt" value="Student" onclick="hideAll(); changeDiv('reserve2', 'block', this); "/> <label for="Gender2" class="plain">Student</label>
<input type="radio" name="certopt" id="certopt" value="International" onclick="hideAll(); changeDiv('reserve2', 'block', this); " /> <label for="Gender1" class="plain">International</label>
<input type="radio" name="certopt" id="certopt" value="Life Member" onclick="hideAll(); changeDiv('reserve2', 'block', this);"/> <label for="Gender2" class="plain">Life Member</label>
<input type="radio" name="certopt" id="certopt" value="Married Partner" onclick="hideAll(); changeDiv('reserve2', 'block', this); "/> <label for="Gender2" class="plain">Married Partner</label></p>
</fieldset>
</div>
<div id="reserve1" style="display: <%=ReserveDisplay%>;">
<fieldset>
<legend>Non Certified Member Options</legend>
<input type="radio" name="noncertopt" id="noncertopt" value="Professional" /> <label for="Gender1" class="plain">Professional</label>
<input type="radio" name="noncertopt" id="noncertopt" value="Student" /> <label for="Gender2" class="plain">Student</label>
<input type="radio" name="noncertopt" id="noncertopt" value="International" /> <label for="Gender1" class="plain">International</label>
<input type="radio" name="noncertopt" id="noncertopt" value="Corportate" /> <label for="Gender2" class="plain">Corportate</label>
<input type="radio" name="noncertopt" id="noncertopt" value="Married Partner" /> <label for="Gender2" class="plain">Married Partner</label></p>
</fieldset>
</div>
<div id="reserve2" style="display: <%=ReserveDisplay%>;">
<fieldset>
<legend>Contact details</legend>
<p title="This field is optional"><label for="FName" >First name:<span class="red">*</span></label> <input type="text" size="50" maxlength="50" name="FName" id="FName"" value="" /><br/>
<label for="MName">Middle name:</label> <input type="text" size="50" maxlength="50" name="MName" id="MName" value="" />
</fieldset>
</form>
</div>
</body>
</html>
i have 2 radio buttons called certified and non certified
when you select certified you see a div which has 5 radio buttons like
student
international
professional
married partner
life member
so when you select for example student you see a div pop up ok i want to transfer the value of student radio button in this div
i am stuck on it
it gives me an error which says value is null or not an object which is this line
the_style.innerHTML = todisplay.value;
i had put an alert to see the value it comes as undefined
please help
thanks,
belord
<%
Option Explicit
Dim ReserveDisplay
ReserveDisplay = "none"
%>
<head>
<title>Membership Application</title>
<script type="text/javascript">
<!--
function changeDiv(the_div,the_change,todisplay)
{
var the_style = getStyleObject(the_div);
alert(todisplay);
if (the_style != false)
{
the_style.display = the_change;
the_style.innerHTML = todisplay.value;
}
}
function hideAll()
{
changeDiv("reserve1", "none");
}
function hideAll1()
{
changeDiv("reserve", "none");
changeDiv("reserve2", "none");
}
function getStyleObject(objectId)
{
if (document.getElementById && document.getElementById(objectId))
{
return document.getElementById(objectId).style;
}
else if (document.all && document.all(objectId))
{
return document.all(objectId).style;
}
else
{
return false;
}
}
function blankall()
{
document.frm1.nscacertificate.checked = false;
document.frm1.nscalapelpin.checked = false;
}
function blankall1()
{
document.frm1.nonone.checked = false;
}
function blankall2()
{
document.frm1.nonone.checked = false;
}
//-->
</script>
</head>
<body>
<div class="content">
<form name="frm1">
<h1 id="text">Membership Application</h1>
<fieldset>
<legend>Membership Options</legend>
<!--this field is used to get the gender of the customer-->
<input type="radio" name="memberopt" id="memberopt" value="Certified" onclick="hideAll(); changeDiv('reserve', 'block');" /> <label for="memberopt" class="plain">Certified</label>
<input type="radio" name="memberopt" id="memberopt" value="Non-Certified" onclick="hideAll1(); changeDiv('reserve1', 'block');" /> <label for="memberopt" class="plain">Non-Certified</label></p>
</fieldset>
<div id="reserve" style="display: <%=ReserveDisplay%>;">
<fieldset>
<legend>Certified Member Options</legend>
<input type="radio" name="certopt" id="certopt" value="Professional" onclick="hideAll(); changeDiv('reserve2', 'block', this); " /> <label for="Gender1" class="plain">Professional</label>
<input type="radio" name="certopt" id="certopt" value="Student" onclick="hideAll(); changeDiv('reserve2', 'block', this); "/> <label for="Gender2" class="plain">Student</label>
<input type="radio" name="certopt" id="certopt" value="International" onclick="hideAll(); changeDiv('reserve2', 'block', this); " /> <label for="Gender1" class="plain">International</label>
<input type="radio" name="certopt" id="certopt" value="Life Member" onclick="hideAll(); changeDiv('reserve2', 'block', this);"/> <label for="Gender2" class="plain">Life Member</label>
<input type="radio" name="certopt" id="certopt" value="Married Partner" onclick="hideAll(); changeDiv('reserve2', 'block', this); "/> <label for="Gender2" class="plain">Married Partner</label></p>
</fieldset>
</div>
<div id="reserve1" style="display: <%=ReserveDisplay%>;">
<fieldset>
<legend>Non Certified Member Options</legend>
<input type="radio" name="noncertopt" id="noncertopt" value="Professional" /> <label for="Gender1" class="plain">Professional</label>
<input type="radio" name="noncertopt" id="noncertopt" value="Student" /> <label for="Gender2" class="plain">Student</label>
<input type="radio" name="noncertopt" id="noncertopt" value="International" /> <label for="Gender1" class="plain">International</label>
<input type="radio" name="noncertopt" id="noncertopt" value="Corportate" /> <label for="Gender2" class="plain">Corportate</label>
<input type="radio" name="noncertopt" id="noncertopt" value="Married Partner" /> <label for="Gender2" class="plain">Married Partner</label></p>
</fieldset>
</div>
<div id="reserve2" style="display: <%=ReserveDisplay%>;">
<fieldset>
<legend>Contact details</legend>
<p title="This field is optional"><label for="FName" >First name:<span class="red">*</span></label> <input type="text" size="50" maxlength="50" name="FName" id="FName"" value="" /><br/>
<label for="MName">Middle name:</label> <input type="text" size="50" maxlength="50" name="MName" id="MName" value="" />
</fieldset>
</form>
</div>
</body>
</html>