Javascript¿ÉÒƶ¯´°¿ÚµÄÉè¼Æ
<html>
<head><title>js¿ÉÒƶ¯´°¿ÚµÄÉè¼Æ</title>
<script language="javascript">
var x0=0,y0=0,x1=0,y1=0;//³õʼ»¯È«¾Ö±äÁ¿
var offx=6,offy=6;
var moveable=false;
var hover='orange';//color;
var index=10000;//z-index;
//¹Ø±Õ´°¿Ú
function closeWin(id)
{
document.getElementById(id).style.display=document.getElementById(id).style.display=="none"?"block":"none";
}
//µã»÷Êó±êÓÒ¼ü×¼±¸¿ªÊ¼Í϶¯´°¿Ú
function startDrag(obj)
{
if(event.button==1) {
obj.setCapture();//ÉèÖÃÊó±ê²¶»ñµÄ¶ÔÏóΪµ±Ç°¶ÔÏ󣬼òµ¥Ëµ¾ÍÊÇ»ñµÃÊó±êÍ϶¯
var win = obj;
x0 = event.clientX;//¼Ç¼µã»÷Êó±êÓÒ¼üµÄÊó±ê×ø±ê
y0 = event.clientY;
x1 = parseInt(win.style.left);//¼Ç¼¿ò¼ÜµÄ³õʼλÖ×—Êó±ê×ø±ê
y1 = parseInt(win.style.top);
normal = obj.style.backgroundColor;
win.style.backgroundColor = hover;
moveable = true;
}
}
//¿ªÊ¼Í϶¯´°¿Ú
function drag(obj)
{
if(moveable)
{
var win = obj;
win.style.left = x1 + event.clientX - x0;//½øÐÐ×ø±êÔËËã²¢¿ØÖÆÑùʽµÄleftÓëtopÊôÐÔ
win.style.top = y1 + event.clientY - y0;
document.getElementById("xy").innerHTML = (x1 + event.clientX - x0)+","+(y1 + event.clientY - y0);//ÏÔʾÊó±êµÄ×ø±ê
}
}
//Í£Ö¹Í϶¯
function stopDrag(obj)
{
var win = obj;
win.style.borderColor = normal;
obj.style.backgroundColor = normal;
obj.releaseCapture();//´Óµ±Ç°¶ÔÏóÖÐÊÍ·ÅÊó±ê²¶»ñµÄ¶ÔÏ󣬼òµ¥Ëµ¾ÍÊÇÊó±êµÄÊÍ·Å
moveable = false;
}
</script>
<style>
.helpdiv {
display: block;
border: 1px dashed #749F4d;
background-color: #F0FAEB;
width: 500px;
padding: 5px;
position: absolute;
&n
Ïà¹ØÎĵµ£º
//´´½¨Ò»¸öеÄÔªËؽڵ㣬ԪËØÃûʹÓÃsTagName¶¨Òå
oElementNode = document.createElementNode(sTagName);
//´´½¨Ò»¸öеĽڵ㣬½ÚµãÃûʹÓÃsTextValue¶¨Òå
oTextNode = document.createTextNode(sTextValue);
//ΪԪËظ³Ò»¸öеÄÊôÐÔ£¬ÊôÐÔÃûʹÓÃsName
oAttribute = document.createAttribute(sName);
//´´½¨Ò»¸öÐ嵀 ......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>ÓÃjavascript¶¯Ì¬Ìí¼Óɾ³ýhtmlÔªËØ</title>
<script type="text/javascript"><!--
function $(nodeId) {
re ......
ת×Ô£ºhttp://www.felixwoo.com/?s=%E9%97%AD%E5%8C%85
ÉîÈëÀí½âJavaScript±Õ°ü(closure)
·¢±íÓÚ: 14:48 | ·ÖÀà: ¿ª·¢¼¼Êõ | ÆÀÂÛ: 25 | ÈËÆø: 6,114 |
×î½üÔÚÍøÉϲéÔÄÁ˲»ÉÙJavascript±Õ°ü(closure)Ïà¹ØµÄ×ÊÁÏ£¬Ð´µÄ´ó¶àÊǷdz£µÄѧÊõºÍרҵ¡£¶ÔÓÚ³õѧÕßÀ´Ëµ±ð˵Àí½â±Õ°üÁË£¬¾ÍÁ¬ÎÄ×ÖÐðÊö¶¼ºÜÄÑ¿´¶®¡£×«Ð´´ËÎĵÄÄ¿µÄ¾ ......
±¾ÎÄÖ÷Òª½éÉÜÈçºÎ¶¯Ì¬µÄÔö¼Ó¡¢É¾³ýÊäÈë¿ò£¬²¢»ñÈ¡ÊäÈë¿òÖеÄÖµ~~
<html>
<head>
<title>JavaScript_¶¯Ì¬Ôö¼Ó/ɾ³ýÊäÈë¿ò_°¢·½Ë÷</title>
<script type="text/javascript">
<!--
var idNumber = 1,id="tableAFS";
function addTextBox() {
idNumber++;
//ÕâÀïÎÒÃÇ´´½¨Ò»¸ölab ......