Compute DHTML Message from Form

[Total: 0    Average: 0/5]

This will create a DHTML message based upon data inside the form fields.

Head Code:

function calc2()
  var _l=document.location.toString();
  if(_l.indexOf("?")==-1)return; /* no posted data */
  var parms=_l.split("?")[1].split("&");
  for(var i=0;i<parms.length;i++)
    var t1=parms[i].split("=");
  var msg="";
  var fn=_first;
  var ln=_last;
  var bd=_birth;
  msg+=fn+", "+ln+" was born on "+bd+".";
function calc1()
  var msg="";
  var fn=document.f1.first.value;
  var ln=document.f1.last.value;
  var bd=document.f1.birth.value;
  msg+=fn+", "+ln+" was born on "+bd+".";

Body Code:

To make the page run at the start, you need to insert this code into the
page's body tag for onload:
&lt;body onload="calc()"&gt;
<BR />
<form name=f1 method=GET>
First:<input name=first value="firstName"><BR />
Last:<input name=last value="lastName"><BR />
Birth:<input name=birth value="DD/MM/YYYY"><BR />
<input type=submit value="Do Your Stuff - Submit">
<input type=button value="On This Page - No Submit" onclick="calc1()">

<div id=writehere></div>

Times Viewed: 0

Leave a Reply

Your email address will not be published. Required fields are marked *