ÈýÖÖ²»Í¬Î»ÖõÄJavaScript´úÂëµÄд·¨
ÈýÖÖ²»Í¬Î»ÖõÄJavaScript´úÂëµÄд·¨
¿Í»§¶Ë½Å±¾JavaScriptÔÚд·¨ÉÏÆäʵÓкܶàÖÖ·½·¨£¬ËüÃǵķÅÖÃλÖÃÒ²·Ç³£Ö®¶à¡£¡£ ÏÂÃæÁоÙÔÚÈýÖÖ²»Í¬µÄµØ·½Ð´JavaScript´úÂ룬ʵÏÖµÄЧ¹û¶¼Êǵã»÷°´Å¥buttonµ¯³öalert¾¯¸æ¿ò
µÚÒ»ÖÖÊÇ×î³£¼ûµÄ£¬´úÂëÈçÏ html´úÂë
<input type="button" value="°´Å¥1" id="btn1" onclick="pop()">
js´úÂë
function pop()
{
alert("ÔÚJavaScriptº¯Êý´¦µ÷ÓÃ");
}
µÚ¶þÖÖÊÇ×î¼òµ¥µÄʵÏÖ·½Ê½£¬´úÂëÈçÏÂ
<input type="button" value="°´Å¥2" id="btn2" onclick="javascript:alert('Ö±½Óдº¯Êý');">
µÚÈýÖÖ·½Ê½Ïà¶Ô¸´ÔÓ£¬´úÂëÈçÏ html´úÂë
<input type="button" value="°´Å¥3" id="btn3">
js´úÂë
var obj=document.getElementById("btn3");//ÒÔÏÂÓï¾äÒ»¶¨Òª·ÅÔÚ¶¨Òåbtn3µÄÏÂÃ棬·ñÔò±àÒëÆ÷ÊDz»ÄÜʶ±ðbtn3µÄ¡£
if(window.addEventListener)// Mozilla, Netscape, FirefoxµÈä¯ÀÀÆ÷
{
obj.addEventListener("click",fun,false);//×¢ÒâÕâÀïµÄfalse
}
else //IEä¯ÀÀÆ÷
{
obj.attachEvent("onclick",fun);
}
function fun()
{
alert("ͨ¹ýÔÚº¯ÊýÖд¥·¢Ê¼þ");
}
×ܽ᣺ÈýÖÖд·¨·½Ê½ÊµÏÖµÄЧ¹ûÊÇÍêÈ«Ò»ÑùµÄ£¬Ó¦¸Ã˵ÈýÖÖ·½Ê½¶¼Êdz£Óõģ¬¶øÇÒ¸÷ÓÐÓÅȱµã¡£¡£¡£¡£
Ïà¹ØÎĵµ£º
1. Javascript Debug Toolkit½éÉÜ
JSDT(Javascript Debug Toolkit)ÊÇÒ»¸öÓÃÓÚjavascriptµ÷ÊÔµÄeclipse
²å¼þ£¬ÓÃÓÚµ÷ÊÔjavascript¡£JSDT¿ÉÒÔ¿çä¯ÀÀÆ÷µ÷ÊÔ£¬Ö§³ÖÔÚIE,Firefox,Safari,ChromeµÈÖ÷Á÷ä¯ÀÀÆ÷Öе÷ÊÔ
javascript¡£JSDTÖ§³ÖÉèÖöϵ㣬µ¥²½µ÷ÊԵȵ÷ÊÔ¹¤¾ßµÄ»ù±¾ÌØÐÔ¡£
2. ÈçºÎ°²×°
JSDTÊÇ»ùÓÚeclipse3.2+,jdk1.5+ ......
1 history.go(0)
2 location.reload() £¨Ò³Ãæ½øÐÐˢУ¬µ«ÎªdisabledµÄÔªËصÄÖµ²»»á±»Çå¿Õ£©
3 location=location
4 location.assign(location)
5 location.replace(location)
6 from..reset() (Ò³Ãæ²»½øÐÐˢУ¬Ä£Äâµ¥»÷¶ÔËùµ÷ÓÃ±íµ¥ÖØÖð´Å¥µÄµ¥»÷)
......
<html>
<body>
<mce:script type="text/javascript"><!--
document.write("<table border=1px>");
for(i=1;i<=9;i++)
{document.write("<tr>");
for (j=1;j<=i;j++)
{document.write("<td class='table1'>"+i+"*"+j+"="+i*j+" & ......
javascriptдÔÚº¯ÊýÀïÃæ
function loadscript(url) {
document.write('<scr' + 'ipt type="text/javascript" src"' + url + '"><\/scr' + 'ipt>'>)
}
Ôڳɹ¦µÄÕýÔò±í´ïʽ²éÕÒÍê³É֮ǰ£¬ÆäÊôÐÔֵΪ undefined¡£
²»Òª½«È«¾Ö RegExp ¶ÔÏóÓë ÕýÔò±í´ïʽ
¶ÔÏó»ìÏý¡£¾¡¹ÜÌýÆðÀ´Ï ......