asp.net¶¯Ì¬×¢²ájavascript×ܽá
Ò».ʹÓÃRegisterStartUpScript×¢²áÖ»Ö´ÐÐÒ»´ÎµÄjavascript
µÚ1²½(´´½¨²¢×¢²á²¢Ê¹ÓÃjavascript)£ºPage.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
//´´½¨JavaScript
string info = "<mce:script type="text/javascript"><!--alert('ÄãºÃ£¬ÎÒÊÇXXX£¡')// --></mce:script>";
//ÅжÏWelcomeÊÇ·ñÒѱ»×¢²á
if (!Page.ClientScript.IsStartupScriptRegistered("Welcome"))
{
//¶¯Ì¬×¢²á²¢Ö´ÐÐJavaScript
Page.ClientScript.RegisterStartupScript(this.GetType(), "Welcome", info);
}
}
¶þ.ʹÓÃRegisterClientScriptBlock×¢²ájavascript
µÚ1²½(´´½¨²¢×¢²ájavascript)£ºPage.aspx.cs
protected void Page_Load(object sender, EventArgs e)
{
//´´½¨JavaScript
string info="";
info += "function showName(username)";
info += "{ alert('ÄúµÄÃû×ÖÊÇ£º'+ username); }";
//ÅжÏmyNameÊÇ·ñÒѱ»×¢²á
if (!Page.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "myName"))
{
//¶¯Ì¬×¢²áJavaScript
Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "myName", info,true);
}
}
µÚ2²½(µ÷ÓÃjavascript)£ºPage.aspx
<form id="form1" runat="server">
<div>
ÐÕÃû£º<input id="txtUserName" type="text" />
<input id="btnSubmit" type="button" value="È·¶¨" onclick="showName(txtUserName.value)" />
</div>
</form>
Èý.ʹÓÃRegisterClientScriptInclude×¢²ájavascript
µÚ1²½(´´½¨javascript)£ºScript/Info.js
function showName(username)
{
alert('ÄúµÄÐÕÃûÊÇ£º'+username);
}
µÚ2²½(µ÷ÓÃjavascript)£ºPage.aspx
<form id="form1" runat="server">
<div>
ÐÕÃû£º<input id="txtUserName" type=
Ïà¹ØÎĵµ£º
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using AlltripDLL;
public pa ......
<script language="javascript">
function ShowTableRow(id)
{
var _Row = document.getElementById(id) <!-- »ñÈ¡IDΪTableRowID µÄ¶ÔÏó -->
var _Img = document.getElementById("Img"+id)
&nb ......
jQuery, MooTools, Prototype µÈÓÅÐãµÄ
JavaScript ¿ò¼ÜÓµÓи÷ÖÖÇ¿´óµÄ¹¦ÄÜ£¬°üÀ¨»æÖÆ Web ͼ±í£¬Ê¹ÓÃÕâЩ¿ò¼ÜÒÔ¼°ÏàÓ¦²å¼þ£¬ÎÒÃÇ¿ÉÒԷdz£ÇáËɵØʵÏÖÇúÏßͼ£¬Ô²±ýͼ£¬Öù״ͼµÈ
Web ͼ±íµÄ»æÖÆ£¬¶ø²»±ØÏóÒÔÍùÄÇÑùͨ¹ý¸´Ô Flash ¼¼ÊõʵÏÖ¡£±¾ÎĽéÉÜÁË9¸öÓÅÐãµÄ»ùÓÚ JavaScript Óë CSS& ......
JSON £¨JavaScript Object Notation£©Ò»ÖÖ¼òµ¥µÄÊý¾Ý¸ñʽ£¬±Èxml¸üÇáÇÉ¡£ JSON ÊÇ JavaScript ÔÉú¸ñʽ£¬ÕâÒâζ×ÅÔÚ JavaScript Öд¦Àí JSON Êý¾Ý²»ÐèÒªÈκÎÌØÊâµÄ API »ò¹¤¾ß°ü¡£
JSONµÄ¹æÔòºÜ¼òµ¥£º ¶ÔÏóÊÇÒ»¸öÎÞÐòµÄ“‘Ãû³Æ/Öµ’¶Ô”¼¯ºÏ¡£Ò»¸ö¶ÔÏóÒÔ“{”£¨×óÀ¨ºÅ£©¿ªÊ¼£¬“}&rdq ......
foreach(Control con in this.Controls[1].Controls)
{
if(con is TextBox)
{
((TextBox)con).Text="";
}
}//Õâ¶Î´úÂëÖ´Ðгɹ¦£¬µ«ÎÒ²»Ã÷°×ÕâÀïµÄ1´úÂëʲô£¿
µ«ÊÇ» ......