NET开发日记12
<script>
funtion mm()
{
....
}
<script>
btnNex.attribute.add("onclick","mm()");
//----------------------------------------------------------------------
<script language=javascript>
function test()
{
alert("in javascript function");
}</script>
Page.RegisterStartupScript("aa","<script language=javascript>test();</script>");
//----------------------------------------------------------------------
//服务器端的控件调用:
//如果javascript的函数写在aspx文件中:
//如
<script language="javascript">
<!--
funtion scripttest()
{
....
}
//-->
<script>
//在cs文件的page_load函数中if (!Page.IsPostBack)外加
//控件ID.attribute.add("onclick","scripttest()");
//直接在cs中写:
if(!IsClientScriptBlockRegistered("clientScript"))
{
string Strscript ="<script>";
Strscript += "alert('a')";
Strscript += "</script>";
RegisterClientScriptBlock("clientScript",Strscript);
}