html頁面中常用的一些小方法整理

字號(hào):


    html頁面中常用的一些小方法整理,網(wǎng)頁制作的朋友可以看下,確實(shí)不錯(cuò)。
    在<Head>標(biāo)簽中加
    <meta http-equiv="pragma " content="no-cache">
    <meta http-equiv="Cache-Control " content="no-cache,must-revalidate">
    <meta http-equiv="expires " content="Wed,26 Feb 1978 08:21:57 GMT ">
    如何用JQuery的ajax跳轉(zhuǎn),可以這樣清理
    //ajax請(qǐng)求不緩存
    $.ajaxSetup({ cache: false
    });
    MaintainScrollPositionOnPostback="true"
    如內(nèi)容超出單元格,則隱藏
    style="TABLE-LAYOUT: fixed"
    讓彈出窗口總是在最上面: <body onblur="this.focus();">
    不要滾動(dòng)條? 讓豎條沒有: <body style='overflow:scroll;overflow-y:hidden'> </body>
    讓橫條沒有: <body style='overflow:scroll;overflow-x:hidden'> </body>
    兩個(gè)都去掉?更簡單了 <body scroll="no"> </body>
    怎樣去掉圖片鏈接點(diǎn)擊后,圖片周圍的虛線? <a href="#" onFocus="this.blur()"><img src="logo.jpg" border=0></a>
    電子郵件處理提交表單 <form name="form1" method="post" action="mailto:****@***.com" enctype="text/plain">
    <input type=submit> </form>
    在打開的子窗口刷新父窗口的代碼里如何寫? window.opener.location.reload()
    如何設(shè)定打開頁面的大小 <body onload="top.resizeTo(300,200);">
    在頁面中如何加入不是滿鋪的背景圖片,拉動(dòng)頁面時(shí)背景圖不動(dòng) <html><head> <STYLE> body {background-image:url(logo.gif); background-repeat:no-repeat; background-position:center } </STYLE> </head> <body bgproperties="fixed" > </body> </html>
    各種樣式的光標(biāo) auto :標(biāo)準(zhǔn)光標(biāo)
    default :標(biāo)準(zhǔn)箭頭
    hand :手形光標(biāo)
    wait :等待光標(biāo)
    text :I形光標(biāo)
    vertical-text :水平I形光標(biāo)
    no-drop :不可拖動(dòng)光標(biāo)
    not-allowed :無效光標(biāo)
    help :?幫助光標(biāo)
    all-scroll :三角方向標(biāo)
    move :移動(dòng)標(biāo)
    crosshair :十字標(biāo) e-resize n-resize nw-resize w-resize s-resize se-resize sw-resize
    本機(jī)ip<%=request.servervariables("remote_addr")%>
    服務(wù)器名<%=Request.ServerVariables("SERVER_NAME")%>
    服務(wù)器IP<%=Request.ServerVariables("LOCAL_ADDR")%>
    服務(wù)器端口<%=Request.ServerVariables("SERVER_PORT")%>
    服務(wù)器時(shí)間<%=now%> IIS
    版本<%=Request.ServerVariables"SERVER_SOFTWARE")%>
    腳本超時(shí)時(shí)間<%=Server.ScriptTimeout%>
    本文件路徑<%=server.mappath(Request.ServerVariables("SCRIPT_NAME"))%>
    服務(wù)器CPU數(shù)量<%=Request.ServerVariables("NUMBER_OF_PROCESSORS")%>
    服務(wù)器解譯引擎<%=ScriptEngine & "/"& ScriptEngineMajorVersion &"."&ScriptEngineMinorVersion
    &"."& ScriptEngineBuildVersion %>
    服務(wù)器操作系統(tǒng)<%=Request.ServerVariables("OS")%>
    文本豎排方式
    <style type="text/css">
    <!--
    .shupai {Writing-mode:tb-rl}
    -->
    </style>
    超鏈接去虛線邊框
    在鏈接中加上onfocus="this.blur()"
    網(wǎng)頁搜索關(guān)鍵字 頭里插入
    <META NAME="keywords" CONTENT="xxxx,xxxx,xxx,xxxxx,xxxx,">
    收藏夾圖標(biāo)
    <link rel = "Shortcut Icon" href="favicon.ico">
    我的電腦
    file:///::%7B20D04FE0-3AEA-1069-A2D8-08002B30309D}
    網(wǎng)上鄰居
    file:///::%7B208D2C60-3AEA-1069-A2D7-08002B30309D%7D
    我的文檔
    file:///::%7B450D8FBA-AD25-11D0-98A8-0800361B1103%7D
    控制面板
    file:///::%7B20D04FE0-3AEA-1069-A2D8-08002B30309D%7D/::%7B21EC2020-3AEA-1069-A2DD-08002B30309D}
    回收站
    file:///::%7B645FF040-5081-101B-9F08-00AA002F954E%7D
    鼠標(biāo)控制圖片隱現(xiàn)效果
    把如下代碼加入<body>區(qū)域中:
    <SCRIPT language="javascript">
    <!--
    function makevisible(cur,which){
    if (which==0)
    cur.filters.alpha.opacity=100
    else
    cur.filters.alpha.opacity=20
    }
    //-->
    </SCRIPT>
    2、把如下代碼加入<body>區(qū)域中:
    <img src="2.gif"
    onMouseOver="makevisible(this,0)"
    onMouseOut="makevisible(this,1)">
    禁止圖片下載
    <A HREF="javascript:void(0)" onMouseover="alert('對(duì)不起,此圖片不能下載!')">
    <IMG SRC="2.gif" Align="center" Border="0" width="99" height="50"></A>
    頁嵌頁
    <iframe width=291 height=247 src="main.files/news.htm" frameBorder=0></iframe>
    隱藏滾動(dòng)條
    <body
    CSS文字陰影(定義在<TD>中)
    .abc{
    FILTER: dropshadow(color=#666666, offx=1, offy=1, positive=1); FONT-FAMILY: "宋體"; FONT-SIZE: 9pt;COLOR: #ffffff;
    }
    列表/菜單
    onchange="location=this.options[this.selectedIndex].value"
    <iframe id="frm" src="k-xinwen.html" scrolling="no" width="314" height="179"></iframe>
    <img src="xiangshang.jpg" onMouseOver="sf=setInterval('frm.scrollBy(0,-2)',1)" onMouseOut="clearInterval(sf)" width="31" height="31">
    <img src="xiangxia.jpg" onMouseOver="sf=setInterval('frm.scrollBy(0,2)',1)" onMouseOut="clearInterval(sf)" width="31" height="31" >
    reurl=server.htmlencode(request.ServerVariables("HTTP_REFERER"))
    服務(wù)器上如何定義連接
    MM_www_STRING ="driver={Microsoft access Driver (*.mdb)};dbq=" & server.mappath("../data/www.mdb")
    鏈接到
    response.redirect"login.asp"
    location.href="xx.asp"
    onClick="window.location='login.asp'"
    onClick="window.open('')"
    取得IP
    userip = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
    If userip = "" Then userip = Request.ServerVariables("REMOTE_ADDR")
    sql="update feedbak set hit=hit+1 where id="&request("id")
    conn.execute(sql)
    截取字符是否加...
    function formatStr(str,len)
    if(len(str)>len)
    str = left(str,len) + "..."
    end if
    formatStr = str
    end function
    接收表單
    If Ucase(Request.ServerVariables("REQUEST_METHOD")) = "POST" then
    end if
    圖片寬度
    <script language="javascript">
    <!--
    var flag=false;
    function DrawImage(ckp){
    var image=new Image();
    image.src=ckp.src;
    if(image.width>0 && image.height>0)
    {flag=true;
    if(image.width>120){
    ckp.width=120;
    }else{
    ckp.width=image.width;
    }
    ckp.alt=image.width+"×"+image.height;
    }
    }
    //-->
    </script>
    I'll be Back 22:18:06
    <img src="<%=formPath%>/<%=rs("photoname")%>" onload="javascript:DrawImage(this);">
    跳轉(zhuǎn)
    <meta http-equiv=refresh content='0; url=/distributor/distributor.aspx'>
    溢出欄的設(shè)制
    visible:超出的部分照樣顯示;
    hidden:超出的部分隱藏;
    scrool:不管有否超出,都顯示滾動(dòng)條;
    auto:有超出時(shí)才出現(xiàn)滾動(dòng)條;
    onMouseOver:鼠標(biāo)移到目標(biāo)上;
    onMouseUp:按下鼠標(biāo)再放開左鍵時(shí);
    onMouseOut:鼠標(biāo)移開時(shí);
    onMouseDown:按下鼠標(biāo)時(shí)(不需要放開左鍵);
    onClink:點(diǎn)擊時(shí);
    onDblClick:雙擊時(shí);
    onLoad:載入網(wǎng)頁時(shí);
    onUnload:離開頁面時(shí);
    onResize:當(dāng)瀏覽者改變?yōu)g覽窗口的大小時(shí);
    onScroll:當(dāng)瀏覽者拖動(dòng)滾動(dòng)條的時(shí)。
    CSS樣式
    a:link:表示已經(jīng)鏈接;
    a:hover:表示鼠標(biāo)移上鏈接時(shí);
    a:active:表示鏈接激活時(shí);
    a:visited:表示己點(diǎn)擊過的鏈接。
    跳出對(duì)話框鏈接
    javascript:alert('lajflsjpjwg')
    后退:javascript:history.back(1)
    關(guān)閉窗口:javascript:window.close();
    窗口還原
    function restore(){
    window.moveTo(8,8);
    window.resizeTo(screen.width-24,screen.availHeight-24);
    }
    head區(qū)是指首頁HTML代碼的<head>和</head>之間的內(nèi)容。
    必須加入的標(biāo)簽
    1.公司版權(quán)注釋
    <!--- The site is designed by Maketown,Inc 06/2000 --->
    2.網(wǎng)頁顯示字符集
    簡體中文:<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
    繁體中文:<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=BIG5">
    英 語:<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
    3.網(wǎng)頁制作者信息
    <META name="author" content="webmaster@maketown.com">
    4.網(wǎng)站簡介
    <META NAME="DESCRIPTION" CONTENT="xxxxxxxxxxxxxxxxxxxxxxxxxx">
    5.搜索關(guān)鍵字
    <META NAME="keywords" CONTENT="xxxx,xxxx,xxx,xxxxx,xxxx,">
    6.網(wǎng)頁的css規(guī)范
    <LINK href="style/style.css" rel="stylesheet" type="text/css">
    (參見目錄及命名規(guī)范)
    7.網(wǎng)頁標(biāo)題
    <title>xxxxxxxxxxxxxxxxxx</title>
    .可以選擇加入的標(biāo)簽
    1.設(shè)定網(wǎng)頁的到期時(shí)間。一旦網(wǎng)頁過期,必須到服務(wù)器上重新調(diào)閱。
    <META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
    2.禁止瀏覽器從本地機(jī)的緩存中調(diào)閱頁面內(nèi)容。
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    3.用來防止別人在框架里調(diào)用你的頁面。
    <META HTTP-EQUIV="Window-target" CONTENT="_top">
    4.自動(dòng)跳轉(zhuǎn)。
    <META HTTP-EQUIV="Refresh" CONTENT="5;URL=http://www.yahoo.com">
    5指時(shí)間停留5秒。
    5.網(wǎng)頁搜索機(jī)器人向?qū)?用來告訴搜索機(jī)器人哪些頁面需要索引,哪些頁面不需要索引。
    <META NAME="robots" CONTENT="none">
    CONTENT的參數(shù)有all,none,index,noindex,follow,nofollow。默認(rèn)是all。
    6.收藏夾圖標(biāo)
    <link rel = "Shortcut Icon" href="favicon.ico">
    所有的javascript的調(diào)用盡量采取外部調(diào)用.
    <SCRIPT LANGUAGE="javascript" SRC="script/xxxxx.js"></SCRIPT>
    附<body>標(biāo)簽:
    <body>標(biāo)簽不屬于head區(qū),這里強(qiáng)調(diào)一下,為了保證瀏覽器的兼容性,必須設(shè)置頁面背景<body bgcolor="#FFFFFF">
    flash透明
    在flash的源代碼中加上:<param name="wmode" value="transparent">
    表格透明
    style="FILTER: alpha(opacity=72)"
    網(wǎng)址前添加icon的方法
    1、上http://www.favicon.com/上用他的icon editor online制作一個(gè)圖標(biāo)。他會(huì)將做好的圖標(biāo)通過email即時(shí)發(fā)送給你。
    2、把這個(gè)命名為favicon.ico的圖標(biāo)放置在index.html同一個(gè)文件夾中。就可以了。
    作一個(gè)圖標(biāo)文件,大小為16*16像素。文件擴(kuò)展名為ico,然后上傳到相應(yīng)目錄中。在HTML源文件“<head></head>”之間添加如下代碼:
    <Link Rel="SHORTCUT ICON" href="http://圖片的地址(注意與剛才的目錄對(duì)應(yīng))">
    其中的“SHORTCUT ICON”即為該圖標(biāo)的名稱。當(dāng)然如果用戶使用IE5或以上版本瀏覽時(shí),就更簡單了,只需將圖片上傳到網(wǎng)站根目錄下,自動(dòng)識(shí)別
    可以在收藏夾中顯示出你的圖標(biāo)<link rel="Bookmark" href="favicon.ico">
    狀態(tài)欄連接說明
    <A HREF="鏈接到某處" onmouseOver="window.status='連接說明';return true;" onMouseOut="window.status=' ';">某某鏈接</a>
    鏈接說明
    <a href=“”Title=鏈接說明>
    禁止鼠標(biāo)右鍵
    在<body>標(biāo)簽中加入 <body oncontextmenu="return false">
    DW里輸入空格
    插入N個(gè)&nbsp;
    水平線
    <hr width="長度" size="高度" color="顏色代碼" noshade> noshade為有無陰影
    表單電子郵件提交
    < form name="content" method="post" action="mailto:電子郵箱" >< /form>
    文本域名為Subject 為郵件的標(biāo)題
    郵件鏈接定制
    Mailto:地址 ? Subject=郵件的標(biāo)題 &bc=抄送 &bcc=密件抄送
    背景音樂
    <bgsound src=地址 loop="-1">
    禁止頁面正文選取
    <body oncontextmenu="return false" ondragstart="return false" onselectstart ="return false"
    onselect="document.selection.empty()" oncopy="document.selection.empty()" onbeforecopy="return false"onmouseup="document.selection.empty()">
    消除ie6自動(dòng)出現(xiàn)的圖像工具欄,設(shè)置 GALLERYIMG屬性為false或no .
    <IMG SRC="mypicture.jpg" HEIGHT="100px" WIDTH="100px" GALLERYIMG="no">
    防止點(diǎn)擊空鏈接時(shí),頁面往往重置到頁首端。
    代碼“javascript:void(null)”代替原來的“#”標(biāo)記
    如何避免別人把你的網(wǎng)頁放在框架中
    <script language=“javascript”><!--if (self!=top){top.location=self.location;} -->< /script>
    頁面定時(shí)刷新
    <meta http-equiv="Refresh" content="秒" >
    頁面定時(shí)轉(zhuǎn)向新的地址
    <meta http-equiv="refresh" content="秒;URL=url">
    顯示日期
    <script language="javascript"><!--
    today=new Date();
    var week; var date;
    if(today.getDay()==0) week="星期日"
    if(today.getDay()==1) week="星期一"
    if(today.getDay()==2) week="星期二"
    if(today.getDay()==3) week="星期三"
    if(today.getDay()==4) week="星期四"
    if(today.getDay()==5) week="星期五"
    if(today.getDay()==6) week="星期六"
    date=(today.getYear())+"年"+(today.getMonth()+1)+"月"+today.getDate()+"日"+" "
    document.write("<span style='font-size: 9pt;'>"+date+week+"</span>");
    // -->
    </script>
    設(shè)為首頁
    <A href=# onclick="this.style.behavior='url(#default#homepage)';this.setHomePage('url');">設(shè)為首頁</A>
    添加收藏
    <A href="javascript:window.external.AddFavorite('url','title')">收藏本站</A>
    文字滾動(dòng)
    插入邊框?yàn)?的1行1列的表格,在表格中輸入文字,選中文字,
    按ctrl+t輸入marquee direction="up", 回車即可讓文字在表格區(qū)域內(nèi)向上滾動(dòng)。
    (right、down可用于讓文字或圖象向右及向下滾動(dòng),修改html原代碼還可以得到需要的滾動(dòng)速度。
    表單驗(yàn)正
    <SCRIPT language=javascript>
    function checkform(theform){
    if(theform.name.value==""){
    alert("姓名不能為空!");
    theform.name.focus();
    return false;
    }
    if(theform.tel.value==""){
    alert("電話不能為空!");
    theform.tel.focus();
    return false;
    }
    }
    </SCRIPT>
    定義鼠標(biāo)
    body{cursor: url(cur.ani或cur);}
    以圖片方式插視頻
    <IMG height=240 loop=infinite dynsrc=http://amedia.efu.com.cn/EFUADD0001.rmvb width=320>
    層在flash上面
    < param name="wmode" value="opaque" >
    延遲跳轉(zhuǎn)
    <meta http-equiv=refresh content='3; url=javascript:window.close();'>
    導(dǎo)航條變色:
    單元格<TR后面插入onmouseover="javascript:this.bgColor='#57AE00'" onmouseout="javascript:this.bgColor='#99CCFF'"
    居中
    <CENTER></CENTER>
    空鏈接
    javascript:;
    標(biāo)題表格
    <fieldset>
    <legend>表格的說明</legend>
    </fieldset>
    細(xì)線表格
    style="BORDER-COLLAPSE: collapse;"
    滾動(dòng)條顏色代碼
    BODY{
    SCROLLBAR-FACE-COLOR: #FFFFFF;
    SCROLLBAR-HIGHLIGHT-COLOR: #FFFFFF;
    SCROLLBAR-SHADOW-COLOR: #FFFFFF;
    SCROLLBAR-3DLIGHT-COLOR: #FFCBC8;
    SCROLLBAR-ARROW-COLOR: #FFFFFF;
    SCROLLBAR-TRACK-COLOR: #FFFFFF;
    SCROLLBAR-DARKSHADOW-COLOR: #FFCBC8;
    SCROLLBAR-BASE-COLOR: #FFFFFF
    }
    連續(xù)的英文或者一堆感嘆號(hào)!!!不會(huì)自動(dòng)換行的問題
    只要在CSS中定義了如下句子,可保網(wǎng)頁不會(huì)再被撐開了
    table{table-layout: fixed;}
    td{word-break: break-all; word-wrap:break-word;}
    注釋一下:
    1.第一條table{table-layout: fixed;},此樣式可以讓表格中有!!!(感嘆號(hào))之類的字符時(shí)自動(dòng)換行。
    2.td{word-break: break-all},一般用這句這OK了,但在有些特殊情況下還是會(huì)撐開,因此需要再加上后面一句{word-wrap:break-word;}就可以解決。此樣式可以讓表格中的一些連續(xù)的英文單詞自動(dòng)換行。
    1、控制橫向和縱向滾動(dòng)條的顯隱?
    <body> 去掉x軸
    <body> 去掉y軸
    <body scroll="no">不顯
    2、表格變色
    <TD onmouseover="this.style.backgroundColor='#FFFFFF'"
    onmouseout="this.style.backgroundColor=''"
    style="CURSOR: hand">
    3、 禁止復(fù)制,鼠標(biāo)拖動(dòng)選取
    <body ondragstart=window.event.returnValue=false oncontextmenu=window.event.returnValue=false
    onselectstart=event.returnValue=false>
    4、 普通iframe頁面
    <iframe name="name" src="main.htm" width="450" height="287" scrolling="Auto" frameborder="0">
    </iframe>
    5、iframe自適應(yīng)高度
    <iframe name="pindex" src="index.asp" frameborder=false scrolling="auto"
    height="100%" frameborder=no onload="document.all['pindex'].style.height=pindex.document.body.scrollHeight" ></iframe>
    6、IE地址欄前換成自己的圖標(biāo)&可以在收藏夾中顯示出你的圖標(biāo)
    <link rel="Shortcut Icon" href="favicon.ico">
    <link rel="Bookmark" href="favicon.ico">
    7、字號(hào)縮放
    越來越多的人長時(shí)間的泡網(wǎng),眼鏡的普及率也越來越高,讓文字大點(diǎn),讓更多的用戶看的更清楚。
    <script type="text/javascript">
    function doZoom(size)
    {document.getElementById('zoom').style.fontSize=size+'px';}
    </script>
    <span id="zoom">需要指定大小的文字</span>
    <a href="javascript:doZoom(16)">大</a> <a href="javascript:doZoom(14)">中</a> <a href="javascript:doZoom(12)">小</a>
    8、select擋住div的解決方法
    在div里加入下面的代碼,根據(jù)需要調(diào)整就可以了。
    <iframe src="javascript:false" scrolling="no" frameborder="0">
    </iframe>
    9、iframe(嵌入式幀)自適應(yīng)高度
    填寫的嵌入地址一定要和本頁面在同一個(gè)站點(diǎn)上,否則會(huì)提示“拒絕訪問!”。對(duì)跨域引用有權(quán)限問題,請(qǐng)查閱其他資料。
    <iframe name="guestbook" src="gbook/index.asp" scrolling=no height="100%"
    frameborder=no onload="document.all['guestbook'].style.height=guestbook.document.body.scrollHeight"></iframe>
    10、 跳轉(zhuǎn)菜單新窗口
    <select name="select" onchange="window.open(this.options[this.selectedIndex].value)">
    <option value="http://www.microsoft.com/ie"> Internet Explorer</option>
    <option value="http://www.microsoft.com/"> Microsoft Home</option>
    <option value="http://msdn.microsoft.com/"> Developer Network</option>
    </select>
    11、flash透明選項(xiàng)
    <param name="wmode" value="transparent">
    12、添加到收藏夾和設(shè)為首頁
    <a href=# onclick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.makewing.com/lanren/');">設(shè)為首頁</a>
    <a href="javascript:window.external.AddFavorite('http://www.makewing.com/lanren/','懶人圖庫')">收藏本站</a>
    13、記錄并顯示網(wǎng)頁的最后修改時(shí)間
    <script language=JavaScript>
    document.write("最后更新時(shí)間: " + document.lastModified + "")
    </script>
    14、節(jié)日倒計(jì)時(shí)
    <Script Language="JavaScript">
    var timedate= new Date("October 1,2002");
    var times= "國慶節(jié)";
    var now = new Date();
    var date = timedate.getTime() - now.getTime();
    var time = Math.floor(date / (1000 * 60 * 60 * 24));
    if (time >= 0)
    document.write( "現(xiàn)在離"+times+"還有: "+time +"天")
    </Script>
    15、加在HEAD里
    禁止緩存
    <meta http-equiv="Expires" CONTENT="0">
    <meta http-equiv="Cache-Control" CONTENT="no-cache">
    <meta http-equiv="Pragma" CONTENT="no-cache">
    16、 讓IFRAME框架內(nèi)的文檔的背景透明
    <iframe src="about:<body style='background:transparent'>" allowtransparency></iframe>
    17、打開窗口即最大化
    <script language="JavaScript">
    <!-- Begin
    self.moveTo(0,0)
    self.resizeTo(screen.availWidth,screen.availHeight)
    // End -->
    </script>
    18、加入背景音樂
    <bgsound src="mid/windblue[1].mid" loop="-1"> 只適用于IE
    <embed src="music.mid" autostart="true" loop="true" hidden="true"> 對(duì)Netscape ,IE 都適用
    19、 滾動(dòng)
    <marquee direction=up height=146 onmouseout=start() onmouseover=stop() scrollAmount=2>滾動(dòng)信息
    </marquee>
    20、防止點(diǎn)擊空鏈接時(shí),頁面往往重置到頁首端
    代碼“javascript:void(null)”代替原來的“#”標(biāo)記
    21、文字或圖片彈出指定大小的窗口
    在body中加入
    <script language="JavaScript" type="text/JavaScript">
    function MM_openBrWindow(theURL,winName,features) {window.open(theURL,winName,features);}
    </script>
    彈出代碼
    <a href="#" target="_self" onClick="MM_openBrWindow('windows01.htm','','width=550,height=380')" width="550" height="380">圖片或文字</a>
    22、 flash按鈕加鏈接
    on (press) {
    getURL("http://www.makewing.com%22,%22_blank/");
    }
    23、跳轉(zhuǎn)頁面代碼
    <meta http-equiv="refresh" content="5;url=http://www.makewing.com">
    24、細(xì)線分隔線
    <hr noshade size=0 color=#C0C0C0>
    25、網(wǎng)頁中的自動(dòng)換行
    <td>就搞定了。
    完整的是
    style="table-layout: fixed;WORD-BREAK: break-all; WORD-WRAP: break-word"
    26、消除ie6自動(dòng)出現(xiàn)的圖像工具欄,設(shè)置 GALLERYIMG屬性為false或no .
    <IMG SRC="mypicture.jpg" HEIGHT="100px" WIDTH="100px" GALLERYIMG="no">
    27、禁止頁面正文內(nèi)容被選取
    <body oncontextmenu="return false" ondragstart="return false" onselectstart ="return false"
    onselect="document.selection.empty()" oncopy="document.selection.empty()" onbeforecopy="return
    false"onmouseup="document.selection.empty()">
    28、不能點(diǎn)右鍵,不用CTRL+A,不能復(fù)制作!
    <body oncontextmenu="window.event.returnValue=false"
    onkeypress="window.event.returnValue=false"
    onkeydown="window.event.returnValue=false"
    onkeyup="window.event.returnValue=false"
    ondragstart="window.event.returnValue=false"
    onselectstart="event.returnValue=false">
    </body>
    29、IE瀏覽器支持一個(gè) Body 屬性 bgproperties,它可以讓背景不滾動(dòng):
    <Body Background="圖片文件" bgproperties="fixed">
    30、隨機(jī)變換背景圖象(一個(gè)可以刷新心情的特效)
    <Script Language="JavaScript">
    image = new Array(4); //定義image為圖片數(shù)量的數(shù)組
    image [0] = 'tu0.gif' //背景圖象的路徑
    image [1] = 'tu1.gif'
    image [2] = 'tu2.gif'
    image [3] = 'tu3.gif'
    image [4] = 'tu4.gif'
    number = Math.floor(Math.random() * image.length);
    document.write("<BODY BACKGROUND="+image[number]+">");
    </Script>
    31、flash載入影片
    on (release)
    {
    loadMovie("1-01.swf", "_root.loaderclip");
    }
    32、圖片表單按鈕
    <form id="form1" name="form1" method="post" action="">
    <img src="login.gif" width="62" height="22" onclick="document.form1.submit()" />
    </form>
    33、左右陰影背景的CSS定義方法
    body {
    text-align:center;
    background-repeat: repeat-y;
    background-position: center;
    background-image: url(../images/bg.jpg);
    }
    34、劃過鏈接 手型鼠標(biāo)
    style="cursor:hand"
    35、如何關(guān)閉層
    <div id="Layer1"></div>
    <a href="#" onClick="Layer1.style.display='none'">關(guān)閉層</a>
    36、關(guān)閉窗口的腳本
    <a href=javascript:close()>[關(guān)閉窗口]</a>
    37、如果文字過長,則將過長的部分變成省略號(hào)顯示
    <DIV STYLE="width: 120px; height: 50px; border: 1px solid blue;overflow: hidden; text-overflow:ellipsis">
    <NOBR>就是比如有一行文字,很長,表格內(nèi)一行顯示不下.</NOBR>
    </DIV>
    38、進(jìn)入主頁后自動(dòng)最大化
    <script>
    self.moveTo(0,0)
    self.resizeTo(screen.availWidth,screen.availHeight)
    </script>
    39、凹陷文字
    <div>
    <font disabled>
    怎么樣,我凹下去了吧?<br>
    你不想試試嗎?<br>
    <a href="http://www.lenvo.cn/%22%3Ewww.lenvo.cn%3C/a%3E%3C/font>
    </div>
    40、運(yùn)行代碼框
    <script>
    function Preview()
    {var TestWin=open('');
    TestWin.document.write(code.value);}
    </script>
    <textarea id=code cols=60 rows=15></textarea>
    <br>
    <button onclick=Preview() >運(yùn)行</button>
    41、給表格做鏈接
    <table onclick="window.open('http://www.makewing.com/', '_blank')">
    <tr>
    <td height="100" bgcolor="f4f4f4">&nbsp;</td>
    </tr>
    </table>
    42、讓彈出窗口總是在最上面
    <body onblur="this.focus();">
    43、CSS文字陰影
    .shadowfont{FILTER: dropshadow(color=#666666, offx=1, offy=1, positive=1); FONT-FAMILY: "宋體"; FONT-SIZE: 9pt;COLOR: #ffffff;}
    44、后退&關(guān)閉窗口
    后退:javascript:history.back(1)
    關(guān)閉:javascript:window.close();
    45、表格透明
    style="FILTER: alpha(opacity=72)"
    46、如何避免別人把你的網(wǎng)頁放在框架中
    <script language=“javascript”><!--if (self!=top){top.location=self.location;} -->< /script>
    47、Alt和Title的區(qū)別
    alt 用來給圖片來提示的。Title用來給鏈接文字或普通文字提示的。
    <a href="#" Title="給鏈接文字提示">文字</a>
    <p Title="給鏈接文字提示">文字</p>
    <img src="圖片鏈接">
    48、所有的javascript的調(diào)用盡量采取外部調(diào)用
    <SCRIPT LANGUAGE="javascript" SRC="js/xxxxx.js"></SCRIPT>
    49、鏈接到
    response.redirect"login.asp"
    location.href="xx.asp"
    onClick="window.location='login.asp'"
    onClick="window.open('')"
    50、基本鏈接樣式
    a:link 表示鏈接的樣式
    a:active 表示當(dāng)前活動(dòng)連接的樣式
    a:hover 表示鼠標(biāo)劃過時(shí)的樣式
    a:visited 表示已經(jīng)訪問過的連接的樣式
    "link-visited-hover-active" 簡記為 "lvha" 即 "love"+"hate"
    51、在同一頁面設(shè)置不同文字鏈接效果的樣式
    <style type="text/css">
    .green {COLOR: #309633}
    .green A:link {COLOR: #309633; TEXT-DECORATION: none}
    .green A:visited {COLOR: #309633; TEXT-DECORATION: none}
    .green A:hover {COLOR: #309633; TEXT-DECORATION: underline}
    .green A:active {COLOR: #309633; TEXT-DECORATION: none}
    </style>
    <a href="#">文字</a>