C#´úÂëÓëjavaScriptº¯ÊýµÄÏ໥µ÷ÓÃ
C#´úÂëÓëjavaScriptº¯ÊýµÄÏ໥µ÷ÓÃ
ÎÊ£º
1.ÈçºÎÔÚJavaScript·ÃÎÊC#º¯Êý?
2.ÈçºÎÔÚJavaScript·ÃÎÊC#±äÁ¿?
3.ÈçºÎÔÚC#ÖзÃÎÊJavaScriptµÄÒÑÓбäÁ¿?
4.ÈçºÎÔÚC#ÖзÃÎÊJavaScriptº¯Êý?
ÎÊÌâ1´ð°¸ÈçÏ£º
javaScriptº¯ÊýÖÐÖ´ÐÐC#´úÂëÖеĺ¯Êý£º
·½·¨Ò»£º1¡¢Ê×ÏȽ¨Á¢Ò»¸ö°´Å¥£¬ÔÚºǫ́½«µ÷Óûò´¦ÀíµÄÄÚÈÝдÈëbutton_clickÖÐ;
2¡¢ÔÚǰ̨дһ¸öjsº¯Êý£¬ÄÚÈÝΪdocument.getElementById("btn1").click();
3¡¢ÔÚǰ̨»òºǫ́µ÷ÓÃjsº¯Êý£¬¼¤·¢clickʼþ£¬µÈÓÚ·ÃÎʺǫ́c#º¯Êý£»
·½·¨¶þ£º1¡¢º¯ÊýÉùÃ÷Ϊpublic
ºǫ́´úÂë(°Ñpublic¸Ä³ÉprotectedÒ²¿ÉÒÔ)
public string ss()
{
return("a");
}
2¡¢ÔÚhtmlÀïÓã¼%=fucntion()%£¾¿ÉÒÔµ÷ÓÃ
ǰ̨½Å±¾
£¼script language=javascript£¾
var a = "£¼%=ss()%£¾";
alert(a);
£¼/script£¾
·½·¨Èý£º1¡¢£¼script language="javascript"£¾
£¼!--
function __doPostBack(eventTarget, eventArgument)
{
var theForm = document.Form1; //Ö¸runat=serverµÄform
theForm.__EVENTTARGET.value = eventTarget;
thefrom.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
--£¾
£¼/script£¾
£¼input id="Button1" type="button" name="Button1" value="°´Å¥" onclick="javascript:__doPostBack('Button1','')"£¾
·½·¨ËÄ£º£¼script language="javascript"£¾
function SubmitKeyClick()
{
if (event.keyCode == 13)
{
event.cancelBubble = true;
event.returnValue = false;
document.all.FunName.value="ÄãÒªµ÷Óõĺ¯ÊýÃû"£»
document.form[0].submit();
}
}
£¼/script£¾
£¼INPUT onkeypress="SubmitKeyClick()" id="aaa" type="text"£¾
£¼input type="hidden" name="FunName"£¾ ¡´£¡--ÓÃÀ´´æ´¢ÄãÒªµ÷Óõĺ¯Êý --¡µ
ÔÚ.CSÀïÓУº
public Page_OnLoad()
{
if (!Page.IsPost())
{
string strFunName=Request.Form["FunName"]!=null?Request.Form["FunName"]:"";
//¸ù¾Ý´«»ØÀ´µÄÖµ¾ö¶¨µ÷ÓÃÄĸöº¯Êý
switch(strFunName)
{
case "enter()":
enter() ; //µ÷Óøú¯Êý
break;
case "ÆäËû":
//µ÷ÓÃÆäËûº¯Êý
break;
default:
//µ÷ÓÃĬÈϺ¯Êý
break;
}
}
}
public void enter()
{
//……±ÈÈç¼ÆËãijֵ
}
ÎÊÌâ2.ÈçºÎÔÚJavaScript·ÃÎÊC#±äÁ¿?
´ð°¸ÈçÏ£º
·½·¨Ò»£º1¡¢Í¨¹ýÒ³ÃæÉÏÒþ²ØÓò·ÃÎÊ£¼input id="xx" type="hidden" runat="server"£¾
·½·¨¶þ£º1¡¢Èçº
Ïà¹ØÎĵµ£º
1. oncontextmenu="window.event.returnValue=false" ½«³¹µ×ÆÁ±ÎÊó±êÓÒ¼ü
<table border oncontextmenu=return(false)><td>no</table> ¿ÉÓÃÓÚTable
2. <body onselectstart="return false"> È¡ÏûÑ¡È¡¡¢·ÀÖ¹¸´ÖÆ
3. onpaste="return false" ²»×¼Õ³Ìù
4. oncopy="return false;" oncut="retu ......
ÔÎÄÍøÖ·£ºhttp://www.ccvita.com/?s=onbeforepaste
javascriptʼþÁбí½â˵javascriptʼþÁбí½â˵
ʼþ ä¯ÀÀÆ÷Ö§³Ö ½â˵
Ò»°ãʼþ onclick IE3¡¢N2 Êó±êµã»÷ʱ´¥·¢´Ëʼþ
ondblclick IE4¡¢N4 Êó±êË«»÷ʱ´¥·¢´Ëʼþ
onmousedown IE4¡¢N4 °´ÏÂÊó±êʱ´¥·¢´Ëʼþ
onmouseup IE4¡¢N4 Êó±ê°´ÏºóËÉ¿ªÊó±êʱ´¥·¢´ËÊ ......
ÉÏƪ½éÉÜÁËÈçºÎÔÚAjax¿Í»§¶ËÓë·þÎñÆ÷¶ËÖ®¼ä´«Ëͼòµ¥µÄÎı¾Êý¾Ý£¬Æäʵ£¬Ò²¿ÉÒÔʹÓÃXML×÷ΪÊý¾Ý´«ËÍ¡¢¹µÍ¨µÄ¸ñʽ£¬Ajax¿Í»§¶ËÈôÒª·¢ËÍXML£¬»ù±¾ÉϾÍÊǽ«XML×÷Ϊ×Ö·û´®£¬ÔÚPOSTÇëÇóʱ·¢ËÍ£¬ÀýÈ磺
*HelloAjax.js
var xmlHttp;
function createXMLHttpRequest() {
if (window.XMLHttpRequest) {
xmlHttp = new ......
¸Õ²ÅÒ»¸öÅóÓѸæËßÎÒËûµÄblogÓÑÇéÁ´½ÓÌ«¶àÁË£¬ËùÒÔ°ÑËùÓÐÁ´½Ó·Åµ½Ò»¸öDIVÖУ¬¼ÓÁ˸ö¹ö¶¯Ìõ£¬¿ÉÊÇËûÓÖ²»Ïëÿ´Î±ðÈËÀ´¿´£¬¿´µ½µÄ¶¼ÊÇÇ°Ã漸¸öÁ´½Ó£¬ÓÚÊÇÎÊÎÒÓÐûÓÐʲô°ì·¨£¬ÏëÁËÒ»¸ö£¬ºÇºÇ£¬ÕýºÃÓиö°ì·¨
styleºóÃæÓÃÓÚÏÞ¶¨DIVÑùʽ²¢¼Ó¹ö¶¯Ìõ£¬Õâ¸ö²»¶à˵
¹Ø¼üµÄµØ·½ÆäʵºÜ¼òµ¥£¬×îºóÁ½ÐÐJavascript¾ÍÊÇÁË£¬Æð×÷ÓõÄÖ»ÓÐ×îº ......
<html>
<head>
<script type="text/javascript">
function goHome(){
  ......