Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

javascript»ñµÃÊó±êµÄ¾ø¶ÔλÖÃ

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head>
<body onmouseMove="getXY(event)">
<script language="JavaScript">
<!--
function mouseX(evt) {
if (evt.pageX) return evt.pageX;
else if (evt.clientX)
   return evt.clientX + (document.documentElement.scrollLeft ?
   document.documentElement.scrollLeft :
   document.body.scrollLeft);
else return null;
}
function mouseY(evt) {
if (evt.pageY) return evt.pageY;
else if (evt.clientY)
   return evt.clientY + (document.documentElement.scrollTop ?
   document.documentElement.scrollTop :
   document.body.scrollTop);
else return null;
}
function getXY(event)
{
    var e = event || window.event;
    var x = mouseX(e);
    var y = mouseY(e);
    document.getElementById("XY").innerHTML = "X:" + x + "<br />Y:" + y;
}
function getX(elementID)
{
        var el = elementID
        return el.offsetLeft
  
}
  
function getY(elementID)
{
        var el = elementID
        return el.offsetTop
  
}

function getElementPositionX(elemID)
{
   var offsetTrail = document.getElementById(elemID);
   var offsetLeft = 0;

   while(offsetTrail)
   {
      offsetLeft += offsetTrail.offsetLeft;


Ïà¹ØÎĵµ£º

Javascript±Õ°ü£¨Closure£©


±Õ°ü£¨closure£©ÊÇJavascriptÓïÑÔµÄÒ»¸öÄѵ㣬ҲÊÇËüµÄÌØÉ«£¬ºÜ¶à¸ß¼¶Ó¦Óö¼ÒªÒÀ¿¿±Õ°üʵÏÖ¡£
ÏÂÃæ¾ÍÊÇÎÒµÄѧϰ±Ê¼Ç£¬¶ÔÓÚJavascript³õѧÕßÓ¦¸ÃÊǺÜÓÐÓõġ£
Ò»¡¢±äÁ¿µÄ×÷ÓÃÓò
ÒªÀí½â±Õ°ü£¬Ê×ÏȱØÐëÀí½âJavascriptÌØÊâµÄ±äÁ¿×÷ÓÃÓò¡£
±äÁ¿µÄ×÷ÓÃÓòÎ޷ǾÍÊÇÁ½ÖÖ£ºÈ«¾Ö±äÁ¿ºÍ¾Ö²¿±äÁ¿¡£
JavascriptÓïÑÔµÄÌØÊâÖ®´¦£¬¾ÍÔ ......

JavaScriptÏÔʾʱ¼ä

Õâ¸öÎÊÌâºÜ¼òµ¥£¬Ö÷ÒªÓÐÏÂÃ漸¸ö֪ʶµã£º
£¨1£©       È¡µÃʱ¼ä£ºvar d=new Date();var time=d.toLocaleString()
£¨2£©       ÏÔʾÔÚÍøÒ³ÉÏ£¬¼ÙÉèдÔÚÒ»¸ö<span>ÖУ¬ÇÒ¸Ã<span>µÄidΪshowTime:
document.getElementById("showTime").innerHTML ......

Javascript ÏÔʾ±êǩҳЧ¹û

ҪʵÏÖÕâ¸ö¹¦ÄܹؼüÊÇÒªÀí½â¿éµÄdisplayÊôÐÔ¡£Ò»¸ö¿éµÄdisplayÊôÐÔÉèΪnone£¬¾ÍÏ൱ÓÚÕâ¸ö¿é²»´æÔÚ¡£ËùÒÔ½«ÒªÏÔʾµÄ¶à¸ö¿éµÄdisplayÊôÐÔÉèΪnone,ÔÙ¸ù¾ÝÐèÒª½«ÒªÏÔʾµÄ¿éµÄdisplayÊôÐÔÉèΪblock¾Í¿ÉÒÔ×ö³ö±êǩҳЧ¹ûÁË¡£
£¨1£©      ½¨±êÇ©ÌâÒÔ¼°¸÷±êÇ©ÌâËù¶ÔÓ¦µÄÏÔʾÄÚÈÝ£º
<span id="span1 ......

javascript»ñÈ¡iframeÎĵµÄÚÈÝ(¼æÈÝIEºÍFirefox)

ÔÚÍøÉÏÕÒµ½ÔÚIEϲÙ×÷IFrameÄÚÈݵĴúÂë:
   
document.frames["MyIFrame"].document.getElementById("s").style.color="blue";
µ«ÊÇÕâÔÚFirefoxÏÂÎÞЧ¡£
ËùÒÔ£¬Ïëµ½ÔÚFirefoxÏÂÓÃFireBugÀ´µ÷ÊÔ¡£¾­¹ýµ÷ÊÔ·¢ÏÖÔÚFirefoxÏ¿ÉÓÃÒÔÏ´úÂëÀ´ÊµÏÖ:
   
document.getElementById("MyIFr ......

javascript µÃµ½µ±Ç°Ò³Ãæ¿ÉÊӸ߶ȺͿí¶È

function getHeight(){
    var yScroll;
    if (window.innerHeight && window.scrollMaxY) {
        yScroll = window.innerHeight + window.scrollMaxY;
    } else if (document.body.scrollHeight > document.body.offs ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ