¼òµ¥µÄjavascriptÍÏקʵÀý
¼òµ¥µÄjavascriptÍÏקʵÀý----> ±¾ÈËÔ´´£¨244796562@qq.com£©
<html>
<head>
<title>ÍÏק²âÊÔ</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div id="box" style="position:absolute;top:100px;left:200px;width:200px;height:200px;background-color:#C0C0C0;border:solid 1px #555555">
<div id="bar" title="¿ÉÒƶ¯" style="cursor:pointer;background-color:#0099FF;border-bottom:solid 1px #555555" mce_style="cursor:pointer;background-color:#0099FF;border-bottom:solid 1px #555555">
<b>title:Í϶¯Ìõ</b>
</div>
content:ÄÚÈÝÇø
</div>
<mce:script type="text/javascript"><!--
function stopBubble(e) {//½ûֹðÅÝʼþ
if (e && e.stopPropagation) {
e.stopPropagation();
} else {
window.event.cancelBubble = true;
}
}
function stopDefault(e) {//½ûֹĬÈÏÐÐΪ
if (e && e.preventDefault) {
e.preventDefault();
} else {
window.event.returnValue = false;
}
return false;
}
function drag(box, bar) {//±»ÍÏקµÄÔªËرØÐëÓÐtop(px)ºÍleft(px)ÊôÐÔ
var lastMouseX, lastMouseY;
if (!box.style.left || !box.style.top) {//Èç¹ûÕæµÄûÓÐtop(px)ºÍleft(px)ÊôÐÔ£¬¼ÓĬÈÏÖµ
box.style.left = "10px";
box.style.top = "10px";
}
function getMousePos(e) {//»ñÈ¡Êó±ê×ø±ê
e = e || window.event;
return {x: e.clientX, y: e.clientY};
}
bar.onmousedown = function(ed) {//³õʼ»¯ÍÏקʼþ
stopBubble(ed);
stopDefault(ed);
var lastMousePos = getMousePos(ed);
lastMouseX = lastMousePos.x;
lastMouseY = lastMousePos.y;
window.top.document.onmousemove = function(em) {//×¢²áÒƶ¯Ê¼þ
stopBubble(em);
stopDefault(em);
var currentMousePos = getMousePos(em);//µ±Ç°Êó±êλÖÃ
var currentMouseX = currentMousePos.x;
var currentMouseY = currentMousePos.y;
var boxLeft = parseInt(box.style.left);//Í϶¯²ãµÄλÖÃ
var boxTop = parseInt(box.style.top);
box.style.left = boxLeft + currentMouseX - lastMouseX +
Ïà¹ØÎĵµ£º
Ö÷Òªº¯Êý CallJScript
BOOL CallJScript(const wchar_t * func, VARIANT * vtParams, int cNumberOfParam, VARIANT * vtResult)
{
if(!func || !func[0])
return FALSE;
CComPtr<IDispatch> spScript;
spScript = GetJScript();
if(!spScript)
return FALSE;
DISPID dispID = NULL;
CC ......
javascriptÊDz»ÄÜÖ±½Ó±È½ÏÁ½¸öÊý×éÊÇ·ñÏàµÈµÄ¡£ÀýÈ磺
var a = [1,2,3];
var b = [1,2,3];
alert(a == b); // false
½á¹ûÊÇ false. Ö¤Ã÷Á½¸öÊý×é²»ÄÜÖ±½Ó±È½ÏÏàµÈ¡£
½â¾ö·½·¨Ò»£º
ÏÈÅÅÐò£¬ÔÙÀûÓÃtoString·½·¨£¬±È½Ï¡£ÀýÈ磺
var a = [1,2,3];
var b = [1,2,3];
alert(a.sort().toString() ......
»ÆÉ«²¿·ÖΪdate.js
<script type="text/javascript" src="/js/date.js"></script>
<input name="date" type="text" id="date" onBlur="checkDay(this)" style="width:160px;" /><INPUT class="button" style="WIDTH: 64px; HEIGHT: 24px" onClick="setday(this,date)"type="button" value="Ñ¡ÔñÈÕÆÚ ......
ÔÚд¶Áºó¸Ð֮ǰ£¬ÏÈ×ÔÎÒ½éÉÜһϣ¬±¾ÈË£¬ÄУ¬24Ë꣬δ»é£¬×Êdz.NET³ÌÐòÔ±£¬ÔÚ¶Á´ËÊé֮ǰÒѾÄܹ»ÊìÁ·µÄÀûÓÃJavaScript½øÐÐ±íµ¥µÄÒ»°ãÑéÖ¤£¨Í¨¹ýdocument.getElementById»ñÈ¡³öÎı¾¿òµÄÖµºóÔÙ½øÐÐif...else...Åжϣ©¡£
¸Õ¸ÕÄõ½´ËÊ飬ÐÄÇéºÃÒ»·¬¼¤¶¯£¬ÎÖ~~~лª×ֵ䣬³¤Ô¼26CM£¬¿íÔ¼18CM£¬¸ßÔ¼3.5 ......
Javascript
ÊÇÒ»¸öºÜÇ¿´óºÜÁé»îµÄÓïÑÔ£¬Äã¼È¿ÉÒÔ°ÑËüµ±×÷ÃæÏò¹ý³ÌµÄÓïÑÔ£¬Ò²¿ÉÒÔ°ÑËüµ±×÷ÃæÏò¶ÔÏóµÄÓïÑÔÀ´Óá£ÕâƪÖ÷Ҫ̽ÌÖÒ»ÏÂÈçºÎÓÃjavascriptÀ´ÊµÏÖÒ»¸ö
SingletonÀà¡£ÏàÐÅÓÐЩ±à³Ì¾ÑéµÄÅóÓÑÃǶÔSingletonģʽ¶¼ºÜÊìϤ¡£Singleton
ģʽÖ÷ÒªÓÃÀ´ÏÞÖÆÒ»¸öÀàµÄ¶à´ÎʵÀý»¯¡£Ò»°ãÀ´ËµÏµÍ³´´½¨µÄʵÀýÔ½ÉÙ£¬Õ¼ÓÃ×ÊÔ´Ô ......