您的位置:首页 > 其它

Enter键代替Tab键的功能;为按钮添加消息框confirm(),alert();动态生成表格

2008-04-15 23:10 253 查看
1 Enter键代替Tab键的功能;

2 为按钮添加消息框confirm();

3 alert();动态生成表格;

========================================

1 使用Enter键代替Tab键的功能

<script language="javascript">

function keyDown()

{

var keycode=event.keyCode;

var keyChar=String.fromCharCode(keycode);

if(keycode==13)

event.keycode=9;

};

document.onkeydown=keyDown;

</script>

2 //为按钮添加消息框

confirm(),alert()

3 //动态生成表格

private void Button1_Click(object sender, System.EventArgs e)

{

int numrows = int.Parse(DropDown1.SelectedItem.Value);

int numcells = int.Parse(DropDown2.SelectedItem.Value);

for (int j=0; j<numrows; j++)

{

TableRow newRow = new TableRow();

for (int i=0; i<numcells; i++)

{

TableCell newCell = new TableCell();

newCell.Controls.Add(new LiteralControl("行 " + j.ToString() + ":"));

TextBox newControl = new TextBox();

newControl.Text = "单元格 " + i.ToString();

newCell.Controls.Add(newControl);

newRow.Cells.Add(newCell);

}

Table1.Rows.Add(newRow);

}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: