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()£¥>¿ÉÒÔµ÷ÓÃ
ǰ̨½Å±¾
< language=java>
var a = "<£¥=ss()£¥>";
alert(a);
</>
·½·¨Èý£º1¡¢< language="java">
<!--
function __doPostBack(eventTarget£¬ eventArgument)
{
var theForm = document.Form1; //Ö¸runat=serverµÄform
theForm.__EVENTTARGET.value = eventTarget;
thefrom.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
-->
</>
<input id="Button1" type="button" name="Button1" value="°´Å¥" onclick="java:__doPostBack('Button1'£¬'')">
·½·¨ËÄ£º< language="java">
function SubmitKeyClick()
{
if (event.keyCode == 13)
{
event.cancelBubble = true;
event.returnValue = false;
document.all.FunName.value="ÄãÒªµ÷Óõĺ¯ÊýÃû"£»
document.form[0].submit();
}
}
</>
<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¡¢Èçºǫ́¶¨ÒåÁËPUBLIC STRING N;ǰ̨jsÖÐÒýÓ
Ïà¹ØÎĵµ£º
¡¡¡¡Bin Ŀ¼ÓÃÀ´´æ·Å±àÒëµÄ½á¹û£¬binÊǶþ½øÖÆbinraryµÄÓ¢ÎÄËõд£¬ÒòΪ×î³õC±àÒëµÄ³ÌÐòÎļþ¶¼ÊǶþ½øÖÆÎļþ£¬ËüÓÐDebugºÍReleaseÁ½¸ö°æ±¾£¬·Ö±ð¶ÔÓ¦µÄÎļþ¼ÐΪbin/DebugºÍbin/Release£¬Õâ¸öÎļþ¼ÐÊÇĬÈϵÄÊä³ö·¾¶£¬ÎÒÃÇ¿ÉÒÔͨ¹ý£ºÏîÄ¿ÊôÐÔ—>ÅäÖÃÊôÐÔ—>Êä³ö·¾¶À´Ð޸ġ£
¡¡¡¡objÊÇobjectµÄËõд£¬ÓÃÓÚ´æ·Å ......
ÎÒÒÔΪ£¬ÔÚËùÓÐģʽÖУ¬×î¼òµ¥¡¢×î³£ÓõľÍÊǹ¤³§Ä£Ê½ÁË£¨°üÀ¨³éÏ󹤳§£©¡£
¹¤³§Ä£Ê½ºÍ³éÏóģʽµÄÇø±ðÔÚÓÚ£¬¹¤³§Ä£Ê½ÊÇͨ¹ý²ÎÊý£¨Ò»°ã½ÐÐͱðÂ룩À´¶¯Ì¬Éú³É¶ÔÏ󣬶ø³éÏ󹤳§±ØÐëÁ˽âÉÏÏÂÎIJÅÄܵ÷ÓÃÏàÓ¦µÄ¶ÔÏó¡£ÊµÀý´úÂëÈçÏ£º
Ò»¡¢¹¤³§Ä£Ê½
public class Factory
{
public static object Create(int type)
{
......
//TransmitFileʵÏÖÏÂÔØ
protected void Button1_Click(object sender, EventArgs e)
{
/*
΢ÈíΪResponse¶ÔÏóÌṩÁËÒ»¸öеķ½·¨TransmitFileÀ´½â¾öʹÓÃRespo ......
(1)stringÊÇÒýÓÃÀàÐÍ£º
stringÊÇÒýÓÃÀàÐÍ£¬Õâ¾ÍÊÇ˵stringÔÚ¶ÑÉϱ£´æÊý¾Ý£¬¶øÔÚÕ»Öд洢µÄÊǶÔÏóµØÖ·£¬ÔÚÀí½âstringÀàÐÍÌØÐÔʱÊ×ÏÈÐèÒª¼ÇסÕâµã¡£Ö»²»¹ýÓëÆäËüһЩÒýÓÃÀàÐÍÏà±È£¬ËüÓÖÓÐһЩ±È½ÏÌØÊâµÄÌØÐÔ£¬±ÈÈçÏÂÃæµÄÕâЩ£º
(2)stringÊDz»¿É±äµÄ(immutable)£º
stringµÄÕâÒ»ÌØÐÔÊÇÖ¸£¬¶ÔÓÚÒÑÓеÄÒ»¸östring¶ÔÏ󣬵±ÄãÐÞ¸ ......