做網(wǎng)站建設(shè) 網(wǎng)頁常用代碼

2016-08-05    分類: 網(wǎng)站建設(shè)

網(wǎng)站建設(shè) 網(wǎng)頁常用代碼

1、數(shù)據(jù)庫連接。
ASP與Access數(shù)據(jù)庫連接:
<%@ language=VBscript%>
<%
dim conn,mdbfile
mdbfile=server.mappath("數(shù)據(jù)庫名稱.mdb")
set conn=server.createobject("adodb.connection")
conn.open "driver={microsoft access driver (*.mdb)};uid=admin;pwd=數(shù)據(jù)庫密碼;dbq="&mdbfile
%>
ASP與SQL數(shù)據(jù)庫連接:
<%@ language=VBscript%>
<%
dim conn
set conn=server.createobject("ADODB.connection")
con.open "PROVIDER=SQLOLEDB;DATA SOURCE=SQL服務(wù)器名稱或IP地址;UID=sa;PWD=數(shù)據(jù)庫密碼;DATABASE=數(shù)據(jù)庫名稱
%>
DW中用字符串連接代碼:
"Driver={Microsoft Access Driver (*.mdb)};DBQ=數(shù)據(jù)庫的絕對路徑"
等做完后再打開數(shù)據(jù)庫服務(wù)器,把
"Driver={Microsoft Access Driver (*.mdb)};DBQ=數(shù)據(jù)庫的絕對路徑"
換成
"Provider=Microsoft.Jet.OLEDB.4.0;data source="& server.mappath("服務(wù)器根目錄下所在數(shù)據(jù)庫路徑")
并把本地服務(wù)器修改成測試服務(wù)器
===================================================================================================
常用SQL語句整理:
(1) 數(shù)據(jù)記錄篩選:
sql="select * from 數(shù)據(jù)表 where 字段名=字段值 order by 字段名 [desc]"
sql="select * from 數(shù)據(jù)表 where 字段名 like ’’%字段值%’’ order by 字段名 [desc]"
sql="select top 10 * from 數(shù)據(jù)表 where 字段名 order by 字段名 [desc]"
sql="select * from 數(shù)據(jù)表 where 字段名 in (’’值1’’,’’值2’’,’’值3’’)"
sql="select * from 數(shù)據(jù)表 where 字段名 between 值1 and 值2"
(2) 更新數(shù)據(jù)記錄:
sql="update 數(shù)據(jù)表 set 字段名=字段值 where 條件表達式"
sql="update 數(shù)據(jù)表 set 字段1=值1,字段2=值2 …… 字段n=值n where 條件表達式"
(3) 刪除數(shù)據(jù)記錄:
sql="delete from 數(shù)據(jù)表 where 條件表達式"
sql="delete from 數(shù)據(jù)表" (將數(shù)據(jù)表所有記錄刪除)
(4) 添加數(shù)據(jù)記錄:
sql="insert into 數(shù)據(jù)表 (字段1,字段2,字段3 …) values (值1,值2,值3 …)"
sql="insert into 目標(biāo)數(shù)據(jù)表 select * from 源數(shù)據(jù)表" (把源數(shù)據(jù)表的記錄添加到目標(biāo)數(shù)據(jù)表)
(5) 數(shù)據(jù)記錄統(tǒng)計函數(shù):
AVG(字段名) 得出一個表格欄平均值
COUNT(*|字段名) 對數(shù)據(jù)行數(shù)的統(tǒng)計或?qū)δ骋粰谟兄档臄?shù)據(jù)行數(shù)統(tǒng)計
MAX(字段名) 取得一個表格欄大的值
MIN(字段名) 取得一個表格欄最小的值
SUM(字段名) 把數(shù)據(jù)欄的值相加
引用以上函數(shù)的方法:
sql="select sum(字段名) as 別名 from 數(shù)據(jù)表 where 條件表達式"
set rs=conn.excute(sql)
用 rs("別名") 獲取統(tǒng)的計值,其它函數(shù)運用同上。
(5) 數(shù)據(jù)表的建立和刪除:
CREATE TABLE 數(shù)據(jù)表名稱(字段1 類型1(長度),字段2 類型2(長度) …… )
例:CREATE TABLE tab01(name varchar(50),datetime default now())
DROP TABLE 數(shù)據(jù)表名稱 (永久性刪除一個數(shù)據(jù)表)
===================================================================================================
網(wǎng)頁防復(fù)制代碼
<SCRIPT LANGUAGE=javascript>
function click() {
alert(’需要復(fù)制,請與站長聯(lián)系!’) }
function click1() {
if (event.button==2) {alert(’需要復(fù)制,請與站長聯(lián)系!’) }}
function CtrlKeyDown(){
if (event.ctrlKey) {alert(’不當(dāng)?shù)目截悓p害您的系統(tǒng)!’) }}
document.onkeydown=CtrlKeyDown;
document.onselectstart=click;
document.
</SCRIPT>
===================================================================================================
改變IE地址欄的IE圖標(biāo)
要先做一個16*16的icon(圖標(biāo)文件),保存為index.ico。把這個圖標(biāo)文件上傳到根目錄下并在首頁<head></head>
之間加上如下代碼:
   <link REL = "Shortcut Icon" href="/index.ico">
===================================================================================================
同意就提交,不同意就回到上一級頁面
<input class="button" type="submit" name="rulesubmit" value="同 意" style="height: 23px">
<input class="button" type="button" name="return" value="不同意" style="height: 23px" onclick="javascript:history.go(-1);">
===================================================================================================
取出數(shù)據(jù)數(shù)里的某個字段的所有的不重復(fù)的記錄!
select distinct(id) from aaa
===================================================================================================
放在inpu的style里!
onmouseover="this.focus()" onfocus="this.select()"
===================================================================================================
給TD加邊框:
style="border-left:1px #0D73D8 solid;border-top:1px #0D73D8 solid; border-right:1px #0D73D8 solid;border-bottom:1px #0D73D8 solid;"
給TD加距離
style="padding-left:3px;padding-top:3px;padding-right:3px;padding-bootum:3px;"
===================================================================================================
上邊是判斷問一下是否要刪除。下面是一個鏈接傳值到角本里去!
<script language="javascript">
function del_class_1(id){
if (confirm("真的要刪除這個大類嗎?"))
window.location.href="Admin_class_ok.asp?id="+id+""
}
</script>

<a href=’javascript:del_class_1(<%=rssort("sortid")%>)’>
實際上是寫一個是不要刪除的類
===================================================================================================
網(wǎng)頁中顯示中文:
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
===================================================================================================
網(wǎng)頁到一定時間就自動跳轉(zhuǎn)
<meta HTTP-EQUIV=refresh Content=’1;url=add.asp’>
頁面定時轉(zhuǎn)向新的地址 :
<meta http-equiv="refresh" content="秒;URL=url">
===================================================================================================
提交按鈕中加入鏈接:
<input name="button" type="submit" value="登陸" onclick="location.href=’a.htm’">
<input type="button" name="Submit" value="按鈕" onClick="javascript:window.open(’checkout.htm’,’_bank’)">
提交按鈕作鏈接按鈕鏈接到另一個頁面
<input type="button" value="跳轉(zhuǎn)" onclick="window.location.href=’xxx.asp’">
===================================================================================================
下拉菜單自動跳轉(zhuǎn)代碼:
<select onChange="javascript:window.open(this.options[this.selectedIndex].value)" >
===================================================================================================
定義網(wǎng)頁角本的語言設(shè)置
<%@ LANGUAGE=ScriptingLanguage %>
必須定義變量的語法
<%Option Explicit%>
===================================================================================================
運行regsvr32 scrrun.dll即可。
刪除fso、regsvr32/u scrrun.dll
===================================================================================================
放上去鼠標(biāo)變成小手的代碼:
style="cursor: hand"
文本區(qū)域框英文自動換行代碼:
style="word-break:break-all"
如內(nèi)容超出單元格,則隱藏
style="TABLE-LAYOUT: fixed"
讓彈出窗口總是在最上面:
<body onblur="this.focus();">
===================================================================================================
不要滾動條
讓豎條沒有: <body style=’overflow:scroll;overflow-y:hidden’> </body>
讓橫條沒有: <body style=’overflow:scroll;overflow-x:hidden’> </body>
兩個都去掉: <body scroll="no"> </body>
===================================================================================================
去掉圖片鏈接點擊后周圍的虛線
<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>
===================================================================================================
如何設(shè)定打開頁面的大小
<body onload="top.resizeTo(300,200);">
===================================================================================================
在頁面中如何加入不是滿鋪的背景圖片,拉動頁面時背景圖不動
<html><head> <STYLE> body {background-image:url(logo.gif); background-repeat:no-repeat; background-position:center } </STYLE> </head> <body bgproperties="fixed" > </body> </html>
===================================================================================================
文本豎排方式
<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">
===================================================================================================
隱藏滾動條:
<body style="overflow-x:hidden;overflow-y:hidden">
===================================================================================================
鏈接到:
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)
===================================================================================================
CSS樣式:
a:link:表示已經(jīng)鏈接;
a:hover:表示鼠標(biāo)移上鏈接時;
a:active:表示鏈接激活時;
a:visited:表示己點擊過的鏈接。
===================================================================================================
跳出對話框鏈接:
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)簽
===================================================================================================
所有的javascript的調(diào)用盡量采取外部調(diào)用:
<SCRIPT LANGUAGE="javascript" SRC="script/xxxxx.js"></SCRIPT>
===================================================================================================
flash透明:
在flash的源代碼中加上:<param name="wmode" value="transparent">
===================================================================================================
表格透明:
style="FILTER: alpha(opacity=72)"
===================================================================================================
禁止頁面正文選取 :
<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()">
===================================================================================================
頁面定時刷新:

<meta http-equiv="Refresh" content="秒" >
===================================================================================================
設(shè)為首頁 :
<A href=# onclick="this.style.behavior=’url(#default#homepage)’;this.setHomePage(’url’);">設(shè)為首頁</A>
添加收藏 :
<A href="javascript:window.external.AddFavorite(’url’,’title’)">收藏本站</A>
===================================================================================================
文字滾動:
插入邊框為0的1行1列的表格,在表格中輸入文字,選中文字,
按ctrl+t輸入marquee direction="up", 回車即可讓文字在表格區(qū)域內(nèi)向上滾動。
(right、down可用于讓文字或圖象向右及向下滾動,修改html原代碼還可以得到需要的滾動速度。
===================================================================================================
表單驗正:
<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>
===================================================================================================
細線表格:
style="BORDER-COLLAPSE: collapse;"
===================================================================================================
滾動條顏色代碼:
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ù)的英文或者一堆感嘆號!!!不會自動換行的問題:
只要在CSS中定義了如下句子,可保網(wǎng)頁不會再被撐開了
table{table-layout: fixed;}
td{word-break: break-all; word-wrap:break-word;}
注釋一下:
1.第一條table{table-layout: fixed;},此樣式可以讓表格中有!!!(感嘆號)之類的字符時自動換行。
2.td{word-break: break-all},一般用這句這OK了,但在有些特殊情況下還是會撐開,因此需要再加上后面一句{word-wrap:break-word;}就可以解決。此樣式可以讓表格中的一些連續(xù)的英文單詞自動換行。
===================================================================================================
用marquee做的滾動字幕語法:
align=# | top | middle| bottom //對齊方式)
BEHAVIOR=ALTERNATE | SCROLL | SLIDE //移動的方式
BGCOLOR=color//底色區(qū)域顏色
DIRECTION=DOWN | LEFT | RIGHT | UP //移動的方向
Loop=n //循環(huán)次數(shù)(默認(rèn)是循環(huán)不止)
Scrolldelay=milliseconds//延時
height=# width=# //區(qū)域面積
hspace=# vspace=# //空白區(qū)域
scrollamount=# //移動的速度
〈marquee align=top behavior=ALTERNATE BGCOLOR=#000000 height=60 width=433 scrollamount=5〉〈/marquee〉
===================================================================================================
延遲跳轉(zhuǎn):
<meta http-equiv=refresh content=’3; url=javascript:window.close();’>
===================================================================================================
層在flash上面:
< param name="wmode" value="opaque" >
===================================================================================================
以圖片方式插視頻:
<IMG height=240 loop=infinite dynsrc=http://amedia.efu.com.cn/EFUADD0001.rmvb width=320>
===================================================================================================
定義鼠標(biāo):
body{cursor: url(cur.ani或cur);}
===================================================================================================
示日期:

<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>
===================================================================================================
如何避免別人把你的網(wǎng)頁放在框架中 :
<script language=“javascript”><!--if (self!=top){top.location=self.location;} -->< /script>
===================================================================================================
消除ie6自動出現(xiàn)的圖像工具欄:
設(shè)置 GALLERYIMG屬性為false或no .
<IMG SRC="mypicture.jpg" HEIGHT="100px" WIDTH="100px" GALLERYIMG="no">
===================================================================================================
背景音樂:
<bgsound src=地址 loop="-1">
===================================================================================================
水平線:
<hr width="長度" size="高度" color="顏色代碼" noshade> noshade為有無陰影
===================================================================================================
禁止鼠標(biāo)右鍵:
在<body>標(biāo)簽中加入 <body oncontextmenu="return false">
===================================================================================================
狀態(tài)欄連接說明:
<A HREF="鏈接到某處" onmouseOver="window.status=’連接說明’;return true;" onMouseOut="window.status=’ ’;">某某鏈接</a>
==================================================================================================
可以選擇加入的標(biāo)簽:
1.設(shè)定網(wǎng)頁的到期時間。一旦網(wǎng)頁過期,必須到服務(wù)器上重新調(diào)閱:
<META HTTP-EQUIV="expires" CONTENT="Wed, 26 Feb 1997 08:21:57 GMT">
2.禁止瀏覽器從本地機的緩存中調(diào)閱頁面內(nèi)容:
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
3.用來防止別人在框架里調(diào)用你的頁面:
<META HTTP-EQUIV="Window-target" CONTENT="_top">
4.自動跳轉(zhuǎn):
<META HTTP-EQUIV="Refresh" CONTENT="5;URL=http://www.yahoo.com">
5.網(wǎng)頁搜索機器人向?qū)?用來告訴搜索機器人哪些頁面需要索引,哪些頁面不需要索引:
<META NAME="robots" CONTENT="none">
CONTENT的參數(shù)有all,none,index,noindex,follow,nofollow。默認(rèn)是all。
===================================================================================================
公司版權(quán)注釋:
<!--- The site is designed by Maketown,Inc 06/2000 --->
網(wǎng)頁顯示字符集L
簡體中文:<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">
網(wǎng)頁制作者信息:
<META name="author" content="webmaster@maketown.com">
網(wǎng)站簡介:
<META NAME="DESCRIPTION" CONTENT="xxxxxxxxxxxxxxxxxxxxxxxxxx">
搜索關(guān)鍵字:
<META NAME="keywords" CONTENT="xxxx,xxxx,xxx,xxxxx,xxxx,">
網(wǎng)頁的css規(guī)范:
<LINK href="style/style.css" rel="stylesheet" type="text/css">
(參見目錄及命名規(guī)范)
===================================================================================================
溢出欄的設(shè)制:
visible:超出的部分照樣顯示;
hidden:超出的部分隱藏;
scrool:不管有否超出,都顯示滾動條;
auto:有超出時才出現(xiàn)滾動條;
onMouseOver:鼠標(biāo)移到目標(biāo)上;
onMouseUp:按下鼠標(biāo)再放開左鍵時;
onMouseOut:鼠標(biāo)移開時;
onMouseDown:按下鼠標(biāo)時(不需要放開左鍵);
onClink:點擊時;
onDblClick:雙擊時;
onLoad:載入網(wǎng)頁時;
onUnload:離開頁面時;
onResize:當(dāng)瀏覽者改變?yōu)g覽窗口的大小時;
onScroll:當(dāng)瀏覽者拖動滾動條的時。
===================================================================================================
圖片寬度:
<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")%>" border="0" onload="javascript:DrawImage(this);">
===================================================================================================
截取字符是否加...
function formatStr(str,len)
if(len(str)>len)
str = left(str,len) + "..."
end if
formatStr = str
end function
===================================================================================================
服務(wù)器上如何定義連接:
MM_www_STRING ="driver={Microsoft access Driver (*.mdb)};dbq=" & server.mappath("../data/www.mdb")
===================================================================================================
列表/菜單
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"))
===================================================================================================
CSS文字陰影(定義在<TD>中)
.abc{
FILTER: dropshadow(color=#666666, offx=1, offy=1, positive=1); FONT-FAMILY: "宋體"; FONT-SIZE: 9pt;COLOR: #ffffff;
}
===================================================================================================
禁止圖片下載:
<A HREF="javascript:void(0)" onMouseover="alert(’對不起,此圖片不能下載!’)">
<IMG SRC="2.gif" Align="center" Border="0" width="99" height="50"></A>
===================================================================================================
從數(shù)據(jù)庫里取出值把它們都放在一個字符串內(nèi)!用逗號連接起來!
dim str
str=""
do while not rs.eof
if instr(str,rs(TypeID))=0 then
str=str&rs("typeid")&","
else
end if
’response.end
rs.movenext
loop
===================================================================================================
去掉循環(huán)字符串最后一個逗號
str=left(str,len(str)-1)
===================================================================================================
關(guān)閉輸入法 <input style="ime-mode:disabled">
===================================================================================================
永遠都會帶著框架
<script language="JavaScript"><!--
if (window == top)top.location.href = "frames.htm"; //frames.htm為框架網(wǎng)頁
// --></script>
===================================================================================================
網(wǎng)頁將不能被另存為
<noscript><iframe src=*.html></iframe></noscript>
===================================================================================================
刪除時確認(rèn)
<a href="javascript:if(confirm("確實要刪除嗎?"))location="boos.asp?&areyou=刪除&page=1"">刪除</a>
===================================================================================================
取得控件的絕對位置
//Javascript
<script language="Javascript">
function getIE(e){
var t=e.offsetTop;
var l=e.offsetLeft;
while(e=e.offsetParent){
t+=e.offsetTop;
l+=e.offsetLeft;
}
alert("top="+t+"/nleft="+l);
}
</script>
//VBScript
<script language="VBScript"><!--
function getIE()
dim t,l,a,b
set a=document.all.img1
t=document.all.img1.offsetTop
l=document.all.img1.offsetLeft
while a.tagName<>"BODY"
set a = a.offsetParent
t=t+a.offsetTop
l=l+a.offsetLeft
wend
msgbox "top="&t&chr(13)&"left="&l,64,"得到控件的位置"
end function
--></script>
===================================================================================================
光標(biāo)是停在文本框文字的最后
<script language="javascript">
function cc()
{
var e = event.srcElement;
var r =e.createTextRange();
r.moveStart("character",e.value.length);
r.collapse(true);
r.select();
}
</script>
<input type=text name=text1 value="123" onfocus="cc()">
===================================================================================================
判斷上一頁的來源
javascript:
document.referrer
===================================================================================================
屏蔽功能鍵Shift,Alt,Ctrl
<script>
function look(){
if(event.shiftKey)
alert("禁止按Shift鍵!"); //可以換成ALT CTRL
}
document.onkeydown=look;
</script>
===================================================================================================
網(wǎng)頁不會被緩存
<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 1997 08:21:57 GMT">
或者<META HTTP-EQUIV="expires" CONTENT="0">
===================================================================================================
怎樣讓表單沒有凹凸感?
<input type=text style="border:1 solid #000000">

<input type=text style="border-left:none; border-right:none; border-top:none; border-bottom:
1 solid #000000"></textarea>
===================================================================================================
.<div><span>&<layer>的區(qū)別?
<div>(division)用來定義大段的頁面元素,會產(chǎn)生轉(zhuǎn)行
<span>用來定義同一行內(nèi)的元素,跟<div>的唯一區(qū)別是不產(chǎn)生轉(zhuǎn)行
<layer>是ns的標(biāo)記,ie不支持,相當(dāng)于<div>
===================================================================================================
不要滾動條?
讓豎條沒有:
<body style="overflow:scroll;overflow-y:hidden">
</body>
讓橫條沒有:
<body style="overflow:scroll;overflow-x:hidden">
</body>
兩個都去掉?更簡單了
<body scroll="no">
</body>
===================================================================================================
在打開的子窗口刷新父窗口的代碼里如何寫?
window.opener.location.reload()
===================================================================================================
獲得一個窗口的大小
document.body.clientWidth; document.body.clientHeight
===================================================================================================
日期減去天數(shù)等于第二個日期
<script language=Javascript>
function cc(dd,dadd)
{
//可以加上錯誤處理
var a = new Date(dd)
a = a.valueOf()
a = a - dadd * 24 * 60 * 60 * 1000
a = new Date(a)
alert(a.getFullYear() + "年" + (a.getMonth() + 1) + "月" + a.getDate() + "日")
}
cc("12/23/2002",2)
</script>
===================================================================================================
選擇了哪一個Radio
<HTML><script language="vbscript">
function checkme()
for each ob in radio1
if ob.checked then window.alert ob.value
next
end function
</script><BODY>
<INPUT name="radio1" type="radio" value="style" checked>Style
<INPUT name="radio1" type="radio" value="barcode">Barcode
<INPUT type="button" value="check" onclick="checkme()">
</BODY></HTML>
===================================================================================================
腳本永不出錯
<SCRIPT LANGUAGE="JavaScript">
<!-- Hide
function killErrors() {
return true;
}
window.onerror = killErrors;
// -->
</SCRIPT>
===================================================================================================
頁面進入和退出的特效
進入頁面<meta http-equiv="Page-Enter" content="revealTrans(duration=x, transition=y)">
推出頁面<meta http-equiv="Page-Exit" content="revealTrans(duration=x, transition=y)">
這個是頁面被載入和調(diào)出時的一些特效。duration表示特效的持續(xù)時間,以秒為單位。transition表示使用哪種特效,取值為1-23:
   0 矩形縮小
   1 矩形擴大
   2 圓形縮小
   3 圓形擴大
   4 下到上刷新
   5 上到下刷新
   6 左到右刷新
   7 右到左刷新
   8 豎百葉窗
   9 橫百葉窗
   10 錯位橫百葉窗
   11 錯位豎百葉窗
   12 點擴散
   13 左右到中間刷新
   14 中間到左右刷新
   15 中間到上下
   16 上下到中間
   17 右下到左上
   18 右上到左下
   19 左上到右下
   20 左下到右上
   21 橫條
   22 豎條
   23 以上22種隨機選擇一種

新聞標(biāo)題:做網(wǎng)站建設(shè) 網(wǎng)頁常用代碼
瀏覽地址:http://www.muchs.cn/news33/18883.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供搜索引擎優(yōu)化建站公司、企業(yè)網(wǎng)站制作、虛擬主機網(wǎng)站制作、靜態(tài)網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)