Reputation: 161
I am kind a new to ASP and i see an example but can't figure out why using
<%if cars="Volvo" then Response.Write("checked")%>
Code:->
<!DOCTYPE html>
<html>
<%
dim cars
cars=Request.Form("cars")
%>
<body>
<form action="demo_radiob.asp" method="post">
<p>Please select your favorite car:</p>
<input type="radio" name="cars"
<%if cars="Volvo" then Response.Write("checked")%>
value="Volvo">Volvo</input>
<br>
<input type="radio" name="cars"
<%if cars="Saab" then Response.Write("checked")%>
value="Saab">Saab</input>
<br>
<input type="radio" name="cars"
<%if cars="BMW" then Response.Write("checked")%>
value="BMW">BMW</input>
<br><br>
<input type="submit" value="Submit" />
</form>
<%
if cars<>"" then
Response.Write("<p>Your favorite car is: " & cars & "</p>")
end if
%>
</body>
</html>
Any help would be appreciated
Upvotes: 0
Views: 753
Reputation: 4509
It is being used to make the radio button checked when output as HTML.
Here is more detailed explaination of the checked attribute - http://www.w3schools.com/tags/att_input_checked.asp
The response.write is printing out the string. Again here is a link to a more detailed explaination - http://www.w3schools.com/asp/met_write_response.asp
HTH
Wade
Upvotes: 2