I would like to mature the idea below of sending a JavaScript variable to asp and with the choices in array
, I am only able to send a choice at the moment:
<!DOCTYPE html>
<html>
<head>
<script>
function getElements()
{
var choices = [];
var els = document.getElementsByName('vehicle');
for (var i=0;i<els.length;i++){
if ( els[i].checked ) {
choices.push(els[i].value);
var resultado = choices[i];
//alert(resultado);
document.location.href = 'GetElementByName.asp?resultado=' + resultado;
}
}
}
</script>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<input type="checkbox" name="vehicle" id="vehicle" value="Bike">I have a bike<br>
<input type="checkbox" name="vehicle" id="vehicle" value="Car">I have a car<br>
<input type="button" onclick="getElements()" value="How many elements named ?">
</form>
</body>
</html>
<%
pega_resultado = request.queryString("resultado")
Response.Write ">" & pega_resultado
%>