Enter Number and Popup Generates Table

[Total: 0    Average: 0/5]

Popup generated by the number enetered will create a table.

Head Code:

<script>
var TARGET="someName";
var WIN=null;
function pop(_page)
{
  WIN=window.open('',TARGET);
  WIN.document.open();
  WIN.document.write(_page);
  WIN.document.close();
}
function doNow()
{
  var _f=document.f1;
  var _rc=_f.row_count.value;
  var _text="";
  _text+="<html><body><table>";
  for(var row=0;row<_rc;row++)
    _text+="<tr><td>ROW #"+(1+row)+"</td></tr>";
  _text+="</table></body></html>";
  pop(_text);
}
</script>

Body Code:

<form name=f1>
<input type=text name=row_count value=4>
<input type=button value="Click Me" onclick="doNow()">
</form>

Times Viewed: 4

Leave a Reply

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