javascript Ò³ÃæÌø×ªÓï¾ä
javascriptÒ³ÃæÌø×ª³£ÓôúÂë
¡¡ °´Å¥Ê½£º
¡¡¡¡<INPUT name="pclog" type="button" value="GO" onClick="location.href='http://www.163.com'">
»òÕß
<input type="button" value="ÖØÐ¹ºÂò" onclick="return goBack();"/>
<script language="javascript">
function goBack(){
history.go(-3);
}
</script>
¡¡¡¡Á´½Óʽ£º
¡¡¡¡<a href="javascript:history.go(-1)">·µ»ØÉÏÒ»²½</a> //-1¿ÉÒÔ¸ù¾ÝÇé¿öÖ¸¶¨£»
¡¡¡¡<a href="<%=Request.ServerVariables("HTTP_REFERER")%>">·µ»ØÉÏÒ»²½</a>
¡¡¡¡Ö±½ÓÌø×ªÊ½£º
¡¡¡¡<script>window.location.href='http://www.163.com.cn';</script>
¡¡¡¡¿ªÐ´°¿Ú£º
¡¡¡¡<a href="javascript:" onClick="window.open('http://www.163.com','','height=500,width=611,scrollbars=yes,status=yes')">Ê®·Ö·½±ã</a>
±¾ÎÄÀ´×ÔCSDN²©¿Í£¬×ªÔØÇë±êÃ÷³ö´¦£ºhttp://blog.csdn.net/Peter_K/archive/2007/01/29/1497226.aspx
Ïà¹ØÎĵµ£º
1. javascript ÊÇÇø·Ö´óСдµÄ£¬°üÀ¨±äÁ¿¡¢º¯ÊýÃûµÈµÈ¡£
2. javascript ÖеıäÁ¿ÊÇÈõÀàÐ͵쬶¨Òå±äÁ¿Ê±Ö»Óà var ÔËËã·û¡£
var test1 = "hi";
»òÕß
var test1 = "hi",test2 = "hello";
»òÕß(¿ÉÒÔÊDz»Í¬µÄÀàÐÍ)
var test1 = "hi",test2 = 12;
»òÕß(¿ÉÒÔ²»Óóõʼ»¯)
var test1;
3. javascript ÿÌõÓï¾äµÄ½áβ&ldqu ......
1¡¢Ê¹ÓÃPage.ClientScript.RegisterClientScriptBlock
RegisterClientScriptBlock·½·¨¿ÉÒÔ°ÑJavaScriptº¯Êý·ÅÔÚÒ³ÃæµÄ¶¥²¿¡£Ò²¾ÍÊÇ˵£¬¸Ã½Å±¾ÓÃÓÚÔÚä¯ÀÀÆ÷ÖÐÆô¶¯Ò³Ãæ¡£
Code
<%@ Page Language="C#" %>
<script runat="server">
protected void Page_Load(object send ......
²»Óò»ÖªµÀ,Ò»ÓòÅÖªµÀÕâÁ½ÕßÊDz»´óÒ»ÑùµÄ,ÏñÔÚjavaÖÐ,ÊÇÖ±½ÓʹÓà ,Èç str1.replace("$","*") °Ñ$ºÅ±ä³É*ºÅ
µ«ÔÚjavascript¾Í²»Ò»Ñù,ҪʵÏÖÉÏÃæµÄ¹¦ÄÜÊÇÕâÑùд: str.replace(/&/g,"*") ÆäÖеÄgÊDzÎÊý,˵Ã÷Òª½«È«²¿µÄ$¶¼±ä³É*
ÏÂÃæ°ÑjavascriptµÄÕ³ÌùÔÚÏÂÃæ:
¶¨ÒåºÍÓ÷¨
replace() ·½·¨ÓÃÓÚÔÚ×Ö·û´®ÖÐÓÃһЩ×Ö·ûÌ ......
//¹ýÂËÁ½¶ËµÄ¿Õ¸ñ
function trim(str){
return str.replace(/(^\s*)|(\s*$)/g, "");
}
//¹ýÂË×ó±ßµÄ¿Õ¸ñ
function ltrim(str){
return  ......