技術討論區 > .NET程式設計討論區
[分享] asp.net 使用vb script 或 java script 範例
(1/1)
小徒兒:
asp .net use vb script or java script example
--- 代碼: ---
private void Page_Load(object sender, System.EventArgs e)
{
// 在這裡放置使用者?#123;式碼以初始化網頁
String scrstr;
//使用 vb script example
scrstr ="<script language=vbscript> \n " +
"Sub "+this.btnDateStart.ClientID+"_onclick() \n" +
"window.alert(\"hahaha\")\n" +
"if isdate(document.all(\""+this.txtDateStart.ClientID +"\").value) then \n" +
"objEF2KDT.varDefaultDateTime=document.all(\""+this.txtDateStart.ClientID +"\").value" +
"\n end if \n" +
"call objEF2KDT.show(1)\n" +
"if objEF2KDT.strDateTime <> \"\" then \n" +
"document.all(\""+this.txtDateStart.ClientID +"\").value = objEF2KDT.strDateTime \n "+
"end if \n" +
"end sub \n" +
"</script>";
Page.RegisterClientScriptBlock("xxx",scrstr);
this.btnDateStart.Attributes.Add("onclick",this.btnDateStart.ClientID+"_onclick()");
//使用 vb script example
}
--- 程式碼結尾 ---
output 對照
--- 代碼: ---
<script language=vbscript>
Sub btnDateStart_onclick()
window.alert("hahaha")
if isdate(document.all("txtDateStart").value) then
objEF2KDT.varDefaultDateTime=document.all("txtDateStart").value
end if
call objEF2KDT.show(1)
if objEF2KDT.strDateTime <> "" then
document.all("txtDateStart").value = objEF2KDT.strDateTime
end if
end sub
</script>
<input type="submit" name="btnDateStart" value="..." id="btnDateStart" onclick="btnDateStart_onclick()" style="height:18px;width:40px;Z-INDEX: 112; LEFT: 224px; POSITION: absolute; TOP: 224px" />
--- 程式碼結尾 ---
導覽
[0] 文章列表
前往完整版本