javascript给服务器控件赋值的一种方法(document.forms[0]['TextBox1'].value)

 

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="javascript.aspx.cs" Inherits="javascript" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    
<title>Untitled Page</title>
</head>
<body onload="javascript:document.forms[0]['TextBox1'].value=Date();">
    
<form id="form1" runat="server">
    
<div>
        
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    
</div>
    
</form>
</body>
</html>

 

 

posted on 2008-08-09 11:37  王丹小筑  阅读(1749)  评论(0)    收藏  举报

导航