JavaScript̰³ÔÉß
<!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><title>̰ʳÉß</title></head>
<body>
<mce:style type="text/css"><!--
.table_back{width:320px;height:320px;border-bottom:1px solid black;border-right:1px solid black;}
.floor{border-left:1px solid black;border-top:1px solid black;font-size:1px;}
--></mce:style><style type="text/css" mce_bogus="1">.table_back{width:320px;height:320px;border-bottom:1px solid black;border-right:1px solid black;}
.floor{border-left:1px solid black;border-top:1px solid black;font-size:1px;}</style>
<mce:script type="text/javascript"><!--
/*--
±êÌ⣺¼òµ¥µÄ̰³ÔÉß
Éè¼Æ£ºÍõ¼¯ðÀ
²©¿Í£ºhttp://blog.csdn.net/zswang
ÈÕÆÚ£º2010Äê1ÔÂ22ÈÕ
--*/
function Snake(options) {
var self = this;
options = options || {};
this.colCount = options.colCount || 20;
this.rowCount = options.rowCount || 20;
this.parent = options.parent || document.body; // ÈÝÆ÷
this.speed = options.speed || 200; // ÒÆ¶¯¼ä¸ôʱ¼ä
this.initLength = options.initLength || 3; // ³õʼ³¤¶È
this.button_replay = document.createElement("input");
this.button_replay.type = "button";
this.button_replay.value = "replay";
this.button_replay.onclick = function() {
self.replay();
};
this.parent.appendChild(this.button_replay);
this.table_back = document.createElement("table");
this.table_back.className = "table_back";
this.table_back.cellPadding = "0px";
this.table_back.cellSpacing = "0px";
this.playing = false; // ÊÇ·ñÔÚ½øÐÐÖÐ
this.floors = {}; // ¾ØÕ󵨰徨Õó [y,x]
for (var i = 0; i < this.rowCount; i++) {
var tr = this.table_back.insertRow(-1);
for (var j = 0; j < this.colCount; j++) {
var td = tr.insertCell(-1);
td.classNa
Ïà¹ØÎĵµ£º
scrollHeight: »ñÈ¡¶ÔÏóµÄ¹ö¶¯¸ß¶È¡£
scrollLeft:ÉèÖûò»ñȡλÓÚ¶ÔÏó×ó±ß½çºÍ´°¿ÚÖÐĿǰ¿É¼ûÄÚÈݵÄ×î×ó¶ËÖ®¼äµÄ¾àÀë
scrollTop:ÉèÖûò»ñȡλÓÚ¶ÔÏó×î¶¥¶ËºÍ´°¿ÚÖпɼûÄÚÈݵÄ×î¶¥¶ËÖ®¼äµÄ¾àÀë
scrollWidth:»ñÈ¡¶ÔÏóµÄ¹ö¶¯¿í¶È
offsetHeight:»ñÈ¡¶ÔÏóÏà¶ÔÓÚ°æÃæ»òÓɸ¸×ø±ê offsetParent ÊôÐÔÖ¸¶¨µÄ¸¸×ø±êµÄ¸ß¶È
offsetL ......
DOMÊÇÕë¶ÔXMLµÄ»ùÓÚÊ÷µÄAPI£¬ËüÓëÓïÑÔÎ޹أ¬ÊµÏÖ·½Ê½ÓкܶàÖÖ£¨¸÷ÓïÑÔ»ù±¾¶¼ÓÐ×Ô¼ºµÄʵÏÖ£©¡£
²»¹ýÎÒÃǾ³£Óõģ¬ÊÇJavaScript ϵÄdomÕë¶ÔxhtmlµÄ²Ù×÷£¬Ö»ÊÇdomµÄÒ»¸ö·ÖÖ§Ó¦Óá£
Ãû´Ê½âÊÍ£º
Dom£ºÎĵµ¶ÔÏóÄ£ÐÍ¡£Document object model
Bom£ºä¯ÀÀÆ÷¶ÔÏóÄ£ÐÍ£¬Ò²¿ÉÒԽд°¿Ú¶ÔÏóÄ£ÐÍ¡££¨window object model.£©
API£ºÓ ......
ͨ³£ÓÃtypeofÀ´ÅжÏjs±äÁ¿µÄÀàÐÍ£¬µ«ºÜ¶àʱºò½ö½ötypeofÂú×ã²»ÁËÒªÇóµÄ¡£
ÎÒдÁËÒ»¸ö×Ô¶¨Ò庯ÊýÀ´×öÕâ¸öÊ£¬ÅжϵıȽÏÈ«ÃæÁË¡£
New
function
varType(v){
if
(
typeof
v===
"object"
){
if
(v===
null
)
return
'null'
;
if
(v.
constructo ......
<a class="bt_3" href="javascript:void(0)" mce_href="javascript:void(0)" id="btnSubmit1" onclick="submitPage()">Ìá½»</a>
submitPage() ÊÇÎÒ¶¨ÒåµÄÒ»¸öº¯Êý£¬ÔÒâÊǵã»÷Õâ¸ö<a>ʱ£¬Ìá½»Ò»¸ö±íµ¥¡£ft, ie6 ¾ÓÈ»²»¿ÉÒÔ£¬ÔõôҲ²»ÄÜÌá½»¡£
¿´À´ÊÇÒòΪ ie6 Ö´ÐÐĬÈ϶¯×÷ÒýÆðÀ´£¬Ä¿Ç°Á½ÖÖ½â¾ö·½·¨£ ......
ÔÚJavaScriptÖÐÀûÓÃdocument.referrer¿ÉÒÔ»ñµÃÌø×ªÇ°ÉÏÒ»Ò³µÄµØÖ·,ÆäʵÔÚÖîÈçAsp,PHPµÈÓïÑÔÖж¼¿ÉÒÔ»ñµÃÕâ¸ö²ÎÊý,Ö»²»¹ýд·¨²»Í¬,È»ºó¿ÉÒÔÅжÏÊÇÄÄÀïÀ´µÄÇëÇó´Ó¶ø×öһЩ´¦Àí.µ«ÊÇJSÖеÄdocument.referreÖ»ÄÜ»ñµÃ<a>±êÇ©´«¹ýÀ´µÄ²ÎÊý.¿´´úÂë
a.html
<html>
<head>
<title>²âÊÔ</title> ......