I would like to do a calculation after a field(birthday) is filled in and display the answer(age) as text on the web page. What is an easy way of displaying it? I know I can call a javascript function but I would like to use a speedscript procedure to do the calculation. Can I call the procedure from the js function. I want to do something along these lines:
#in head#
<script type="text/javascript">
function newage(){
<% run p-birth. %>
document.getElementById("theage").innerHTML = "  `uage` ";
}
</script>
<%procedure p-birth.
code to do calculation and assign uage
%>
#in body#
<tr>
<td align="right" width="157">
Birth Date:
</td>
<td width="255">
<input type="text" name="birth" size="15" xlength="10"
value="`qbirth format "99/99/9999"`" onblur="newage()"/>
Age:<span id="theage"> `qage` </span>
</td>
</tr>
#in head#
<script type="text/javascript">
function newage(){
<% run p-birth. %>
document.getElementById("theage").innerHTML = "  `uage` ";
}
</script>
<%procedure p-birth.
code to do calculation and assign uage
%>
#in body#
<tr>
<td align="right" width="157">
Birth Date:
</td>
<td width="255">
<input type="text" name="birth" size="15" xlength="10"
value="`qbirth format "99/99/9999"`" onblur="newage()"/>
Age:<span id="theage"> `qage` </span>
</td>
</tr>