悬赏:javascript小实例代码!

就是用javascript脚本写一个程序!
要求如下:在一个表格中有两个下拉列表,一个代表要选择的tabel行数,一个代表列数!比如,当我选择3行,5列的时候,在页面中出现一个3行5列的表格!就这样!悬赏分20!!!在线等候!
<html>
<body>
row:<select id="row"培袭磨>
<option value="禅轿1">1</option>
<option value="2">2</option>
<option value="3">3<配斗/option>
</select>

col:<select id='col'>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>

<input type="button" onclick=createTab() value="生成table" />
<script type="text/javascript">
var tab = null;
function createTab(){
if(tab != null){
document.body.removeChild(tab);
}
var row = document.getElementById("row").value;
var col = document.getElementById("col").value;
tab=document.createElement('table');
tab.border=1;
for(var i=0;i<row;i++){
var tr=tab.insertRow();
for(var j=0;j<col;j++){
var td=tr.insertCell();
td.innerHTML="这是第"+(i+1)+"行,第"+(j+1)+"列";
}
}

document.body.appendChild(tab);
}
</script>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title></title>
<script type="text/javascript" >
function dT(){
var table = null;
var t = document.getElementById("t");
if(table != null){body.removeChild(table);}
table = document.createElement("table")
table.id="here";
table.border="1";
t.appendChild(table);
draw();
}
function draw(){
var row;
var col;
row = document.getElementById("row").value;
col = document.getElementById("col").value;
var tar = document.getElementById("here");
tar.innerHTML=null;
for(r = 0; r < row; r++){
var tr = document.createElement("tr");
for(c = 0; c < col; c++){
var td = document.createElement("td");
td.innerHTML="hello"
tr.appendChild(td);
}
tar.appendChild(tr);
}
body.appendChild(tar);
}
</script>
</head>
<body>
<select id="row" name="row" value="row" >
<option value="3" selected>3</option>
<option value="4">4</option>
<圆亮桥/select>
<select id="col" name="col" value="row" >
<option value="5">5</option>
<option value="2" selected>2</option>
</select>
<橘猛input type="button" id="test" name="test" value="test" onclick="dT();" />
<br><br><br>
<span id="t"键乎 name="t" ></span>

</body>
</html>
<html>
<head>
<title>Insert title here</title>

<script type="text/javascript">

function createTable()
{
var r = document.getElementById("row").value;
var c = document.getElementById("col").value;

var table = document.createElement("table");
var tbody = document.createElement("tbody");
table.width = 300;//可以设计成 动态的 自己改吧!
table.height = 200;
table.border = 1;

for(var i=1;i<=r;i++)
{
var tr = document.createElement("tr");
for(var j=1;j<=c;j++)
{
var td = document.createElement("td");
td.innerHTML = i + "" + j;//记录行数和列数

td.style.color = "#FF0000";
tr.appendChild(td);
}
tbody.appendChild(tr);
}
table.appendChild(tbody);
document.getElementById("薯脊hwj").appendChild(table);
}

</script>

</head>
<body>
行数<input type="text" id="耐薯row"/><br>
列数<input type="text"数亩渗 id="col"/><br>
<input type="button" onclick="createTable()" value="创建">
<div id="hwj"></div>
</body>
</html>

这是需要自己输入 行数 和 列数的 下拉列表 自己修改吧!