JavaScript³£Ó÷½·¨×ܽᗗÀûÓýű¾·â×°
ÀûÓýű¾·â×°£¬·½±ãʵÏÖÍøÕ¾Ðü¸¡¹ã¸æ
ÏÂÃæÊÇJS½Å±¾(floatdiv.js)
/*======================================================================
¸¡¶¯¿éÖ§³Ö½Å±¾
DESIGN BY : Åí¹ú»Ô
DATE: 2004-02-26
SITE: http://kacarton.yeah.net/
BLOG: http://blog.csdn.net/nhconch
EMAIL: kacarton@sohu.com
ÎÄÕÂΪ×÷ÕßÔ´´£¬×ªÔØÇ°ÇëÏÈÓë±¾ÈËÁªÏµ£¬×ªÔØÇë×¢Ã÷ÎÄÕ³ö´¦¡¢±£Áô×÷ÕßÐÅÏ¢£¬Ð»Ð»Ö§³Ö£¡
======================================================================*/
var alLeft = 0, alCenter = 1, alRight = 2; //ˮƽ¶ÔÆ뷽ʽ
var alTop = 0, alMiddle = 1, alBottom = 2; //´¹Ö±¶ÔÆ뷽ʽ
var f = new Array();
var cnt = 0;
function floatDiv(objId, align, vAlign, x, y, smooth)
{
/*¸¡¶¯¿é¶ÔÏó
Êý¾Ý½á¹¹£º
objId£º ¶ÔÏóID
align£º ˮƽ¶ÔÆ뷽ʽ£¬Ã¶¾ÙÐÍ
vAlign£º´¹Ö±¶ÔÆ뷽ʽ£¬Ã¶¾ÙÐÍÄÚÈÝ
x, y£º xy×ù±ê£¬ÕûÐÍ
smooth£ºÆ½»¬Òƶ¯£¬²¼¶ûÐÍ
*/
this.objId = objId;
this.align = align;
this.vAlign = vAlign;
this.x = x;
this.y = y;
this.smooth = smooth;
}
function addDiv(objId, align, vAlign, x, y, smooth)
{ //Ìí¼Ó¸¡¶¯¿é
f[cnt++] = new floatDiv(objId, align, vAlign, x, y, smooth);
}
function floatMove()
{ //ÖØж¨Î»¸÷¿éλÖÃ
var objX, objY;
if (document.all)
{
var d = document.body;
//status = "scrollLeft:"+f[0].objId.style.pixelTop+"| offsetWidth:"+d.offsetWidth;
for (var i=0; i<f.length; i++)
{
switch (f[i].align)
{
case alLeft : objX = d.scrollLeft + f[i].x; break;
case alCenter: objX = d.scrollLeft + Math.ceil((d.offsetWidth - f[i].objId.offsetWidth)/2) + f[i].x; break;
case alRight : objX = d.scrollLeft + d.offsetWidth - f[i].x - f[i].objId.offsetWidth - 20; break; //¼õ¹ö¶¯Ìõ20
}
switch (f[i].vAlign)
{
case alTop : objY = d.scrollTop + f[i].y; break;
case alMiddle: objY = d.scrollTop + Math.ceil((d.offsetHeight - f[i].objId.offsetHeight)/2) + f[i].y; break;
case alBottom: objY = d.scrollTop + d.offsetHeight - f[i].y - f[i].objId.offsetHeight; break;
}
if (f[i].smooth) smoothMove(f[i].objId, objX, objY);
else
{
f
Ïà¹ØÎĵµ£º
¡¶Îò͸JavaScript¡·Ñ§Ï°±Ê¼Ç
ÔÎĵØÖ·£ºhttp://www.cnblogs.com/leadzen/archive/2008/02/25/1073404.html
ÕâÊÇÒ»±¾ºÜÐÎÏóÉú¶¯µÄÊ飬ʹÎÒÃÇ¿ÉÒÔ¸üÉîµØÁ˽âÁËJavaScript¡£
ÒýÑÔ
±à³ÌÊÀ½çÀïÖ»´æÔÚÁ½ÖÖ»ù±¾ÔªËØ£¬Ò»¸öÊÇÊý¾Ý£¬Ò»¸öÊÇ´úÂë¡£±à³ÌÊÀ½ç¾ÍÊÇÔÚÊý¾ÝºÍ´úÂëǧ˿ÍòÂƵ ......
1. document.write( " "); Êä³öÓï¾ä
2.JSÖеÄ×¢ÊÍΪ//
3.´«Í³µÄHTMLÎĵµË³ÐòÊÇ:document- >html- >(head,body)
4.Ò»¸öä¯ÀÀÆ÷´°¿ÚÖеÄDOM˳ÐòÊÇ:window- >(navigator,screen,history,location,document)
5.µÃµ½±íµ¥ÖÐÔªËصÄÃû³ÆºÍÖµ:document.getElementById( "±íµ¥ ......
Ò»£¬½Å±¾³ÌÐòÓëjavascript
ǶÌ×ÔÚHTMLÖеÄÓïÑÔ³ÆΪ½Å±¾ÓïÑÔ£¬ä¯ÀÀÆ÷±ØÐë¾ßÓнű¾ÒýÇæ¶ÔǶÈëHTMLÖеĽű¾³ÌÐò½øÐнâÊÍ¡£
eg:
<HTML>
<script language="JavaScript">
//VBScript,Jscript,ECMAScript
<!--
alert(n ......
½üÈÕ£¬ÖªÃû¼¼Êõ¿ª·¢ÍøÕ¾SYS-CON ýÌåÁгöÊ®¸öÓ¦ÓÃ×î¹ãµÄjavascript¿ò¼Ü¡£ÎÄÕÂ˵£¬Javascript¿âÒѾ³ÉΪÉè¼ÆÓÅÐãÍøÕ¾µÄ»ù´¡£¬µ±½ñ¼¸ºõËùÓÐÕ¾µã¶¼´øÓÐJavascript»òAjaxÔªËØ¡£ÔÚWeb2.0¿ª·¢´ó³±ÖУ¬ËüÒ²ÐíÊÇ×î¹Ø¼üµÄÒªËØ¡£
ÒÔÏÂÊ®´óJavascript¿ò¼Ü£¬Äã³£ÓÃÆäÖеļ¸¸ö?
1. script.aculo.us (http://script.aculo.us/)
......
ÍøÒ³³£ÓÃС¼¼ÇÉ
1. oncontextmenu="window.event.returnValue=false" ½«³¹µ×ÆÁ±ÎÊó±êÓÒ¼ü
<table border oncontextmenu=return(false)><td>no</table> ¿ÉÓÃÓÚTable
2. <body onselectstart="return false"> È¡ÏûÑ¡È¡¡¢·ÀÖ¹¸´ÖÆ
3. onpaste="return false" ²»×¼Õ³Ìù
4. oncopy="return fa ......