javaScript¼òµ¥µÄ±í¸ñ±ß¿òÉÁ˸Ч¹û¡£
òËÆCSDNÀïµÄ¶¼ÊÇרҵÈËÊ¿£¬¸ßÊÖ¿ÉÒÔÂÓ¹ýÁË£¬ºÇºÇ¡£
Ò»ÏÂÊÇÔ´Â룺
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>ÎÞ±êÌâÎĵµ</title>
</head>
<body>
<script language="javascript">
i=0
var c=new Array(3)
c[0]="red"
c[1]="yellow"
c[2]="blue"
c[3]="pink"
c[4]="black"
c[5]="white"
c[6]="green"
function flash(){
a.style.borderColor=c[i]
i++
if(i>6)
i=0;
setTimeout("flash()",500)
}
</script>
<table width="392" height="240" border="5" id="a" >
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<script language="javascript">flash()</script>
</body>
</html>
Ïà¹ØÎĵµ£º
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() ·½·¨ÓÃÓÚÔÚ×Ö·û´®ÖÐÓÃһЩ×Ö·ûÌ ......
1.document.formName.item('itemname')µÄÎÊÌâ
˵Ã÷£ºIEÏ¿ÉÒÔʹÓÃdocument.formName.item('itemname')ºÍdocument.formName.elements('elementsName');
FFÏÂÖ»ÄÜʹÓÃdocuement.formName.elements('elementsName');
½â¾ö·½·¨£ºÍ³Ò»Ê¹ÓÃdocuement.formName.elements('elementsName');
2.¼¯ºÏÀà¶ÔÏóÎÊÌâ
˵Ã÷£ºIEÏ¿ÉÒÔʹÓÃ[]ºÍ ......
1. Ò»ÖÖÃæÏò¶ÔÏóÓïÑÔÐèÒª¿ª·¢ÕßÌṩÒÔÏÂËÄÖÖ»ù±¾ÄÜÁ¦¡£
£¨1£©·â×°---°ÑÏà¹ØÐÅÏ¢£¨ÎÞÂÛÊôÐÔ»¹ÊÇ·½·¨£©´æ´¢ÔÚ¶ÔÏóÖеÄÄÜÁ¦¡£
£¨2£©¾Û¼¯---°ÑÒ»¸ö¶ÔÏó´æ´¢ÔÚÁíÒ»¸ö¶ÔÏóÄÚµÄÄÜÁ¦¡£
£¨3£©¼Ì³Ð---ÓÉÁíÒ»¸öÀࣨ»ò¶à¸öÀࣩµÃÀ´ÀàµÄÊôÐÔ»ò·½·¨µÄÄÜÁ¦¡£
£¨4£©¶à̬---±àдÄÜÒÔ¶àÖÖ·½·¨ÔËÐеĺ¯Êý»ò·½·¨µÄÄÜÁ¦¡£
2. °Ñ¶ÔÏóµÄËù ......
with(document)
{
write ("test");
write
("dsasfda");
}
ÉÏÃæÊÇÓÃÁËwith
Èç¹û²»ÓõĻ°¾ÍÒªÕâÑùдÁË
document.write (" ......