2023-05-09 分類: 網(wǎng)站建設(shè)
以下是以前學(xué)習(xí)html時(shí)候總結(jié)的一些短語(yǔ)和方法,包括一些html使用技巧,希望大家認(rèn)真閱讀后有所幫助。
<a href="#"></a>
<a href="html.exe"></a>
<a href="mailto:icyzhl@163.com?cc=icyzhl@126.com&subject='你好'&body='你好啊'"></a>
<a href="#ffff"></a>
<a name="ffff"></a>
<a href="javascript:alert('你好')"></a>
<a href="####"></a>
<a href="javascript:void(0)"></a>
<a href="javascript:void(null)"></a>
<a href="javascript:;"></a>
<a href="#" onclick="return false"></a>
<span style="cursor:hand"></span>
a:link {font-size:12px;color:red;text-decoration:none;font-style:italic}
a:link {font-size:14px;color:red;font-weight:normal;text-decoration:underline;font-style:normal}
a:link {font-size:12px;font-family:華文行楷;font-weight:bolder;color:red;text-decoration:overline}
style="writing-mode:tb-rl"
style="writing-mode:lr-tb"
<form>
<select onchange="document.body.style.background=this.options[this.selectedIndex].value">
<option value=url(1.jpg)>背景1
<option value=url(2.jpg)>背景2
<option value=url(3.jpg)>背景3
</select></form>
調(diào)用css
favicon
<link href="" rel="shortcut icon">
<link href="" rel="bookmark">
<link href="css文件地址" rel="stylesheet">
<style type="text/css">
在此寫css
</style>
<span style="css樣式內(nèi)容"></span>
<style style="text/css">
@import url("")
</style>
text-decoration:none
text-decoration:overline
text-decoration:underline
text-underline-position:above/below(IE專有屬性)
text-decoration:line-through
text-transform:uppercase/lowercase/capitalize
font-size:大小
font-family:字體
font-style:normal/italic
font-weight:normal/bold/bolder/lighter
line-height:120%
writing-mode:tb-rl/lr-tb
text-indent:?px
綜合 font:樣式 變形 加粗 字號(hào)/行高 字體
example----font:italic bold 12px/120% 華文行楷
定義 調(diào)用
.css1 {} class=css1
#css2 {} id=css2
table {} 說(shuō)明table 中的所有屬性
table#css1 {} table中的所有css1都有這個(gè)屬性 id=css1
table.css1 {} table中的所有css1都有這個(gè)屬性 class=css1
body,table,input {} table和body和input都有這個(gè)屬性
table #css1 table中其他標(biāo)簽擁有的屬性 <table>...<span id=css1
table .css1 table中其他標(biāo)簽擁有的屬性 <table>...<span class=css1
image:
vaspace hspace width heigth dynsrc src lowsrc alt
form :
input type="text/password/radio/checkbox/sunmit/file/hidden/botton"
select option
textarea
onmouseover="this.focus() onfocus=this.select()"
onmouseover="this.value=''"
font:
i b u strike < > & "' ® ©
在網(wǎng)頁(yè)中加入html代碼只要在代碼前后加入:<xmp>和</xmp>就可以了
size color
basefont color:red;... base href="" base target="_top"
table td tr:
align=center/right/left leftmargin topmargin cursor oncontentmenu
ondragstart oncopy oncut onpaste onselectstart bgcolor background
width heigth id cellpadding cellspacing border
bgsound:
loop=-1/infinite balance volume autostart
marquee:
direction:up/down/left/right
align:center/right/left/right
behavior:scroll slide alternate
vspace hspace height width bgcolor
scrolldelay scrollamount
<span title="你好">你好</span>
<span onmouseout="window.status=''" onmouseover="window.status='你好'" style="cursor:hand"></span>
favicon <link href="" rel="shortcut icon">
oncontextmenu="return false"
ondraystart="return false"
onselectstart="return false"
oncopy="return false"
onpaste="return false"
oncut="return false"
<meta http-equiv="refresh" content="5;url=http://www.baidu.com"
<meta name="description" content="內(nèi)容"
<meta name="keywords" conternt="內(nèi)容"
<meta name="author" content="張虹亮"
<meta http-equiv="page-enter" content="revealtrans(duration='3';transition='23')"
<meta http-equiv="page-exit" content="revealtrans(duration='3';transition='23')"
<meta http-equiv="content-type" content="text/html;charset=gb2312"
取消表單按下時(shí)的虛線
<input type=radio hidefocus=true name=sex>你好
<input type=radio name=sex onfocus="this.blur()">你不好
加入收藏:
<form>
<input type="submit" onclick="window.external.addfavorite('http://www.softku.com.cn','軟酷下載')"></form>
a的全寫:anchor
<base target="_top">防止點(diǎn)擊鏈接時(shí)新窗口都是在頂部打開(kāi)
<p><br>比<br><p>多一行
如何讓網(wǎng)頁(yè)中的廣告自動(dòng)關(guān)閉:
---在網(wǎng)頁(yè)廣告條的網(wǎng)頁(yè)head和/head中加入:
<script language="javascript">
function close(){
setTimeout("self.close()",5000)
}//本網(wǎng)頁(yè)自動(dòng)在5秒鐘關(guān)閉
</script>
或者:
function close(){
self.close()
}
setinterval("close()",5000)
</script>
frameset frame iframe:
border bordercolor src name rows cols framespacing frameborder
flash透明:
<param name="wmode" value="transparent">
半透明的表格:
<table cellpadding=0 cellspacing=0 width=200 height=100><tr><td style="background-color:red;filter:alpha(opacity=20)"> </td></tr></table>
陰影表格:
<div style="filter:shadow(color=red,direction=120);width=200;padding-right:10;padding-bottom:10">
<table cellpadding=0 cellspacing=0 width=200 height=100 bgcolor=red><tr><td> </td></tr></table></div>
特色的表單:
<form>
<input type="button" value="空的" disabled>
<input type="text" value="520" readonly>
<input type="text" size=30 style="border-top:1px dashed red;border-bottom:1px dashed black;border-right:1px dashed blue;border-left:1px dashed orange;"
</form>
<embed src="" width height>
<bgsound src="" loop=-1/infinite autostart=false/true>
<param name="wmode" value="transparent">
背景更換效果
<style type="text/css">
.css1 {background-image:url("1.jpg")}
.css2 {background-image:url("2.jpg")}
</style>
<table><tr><td onmouseout="this.className='css1'" onmouseover="this.className='css2'">sage</td></tr></table>
關(guān)閉網(wǎng)頁(yè)
<script language="javascript">
function closewindow(){
window.opener=null
window.close()
}
</script>
調(diào)用:<form><input type="button" onclick="javascript:closewindow()"></form>
鼠標(biāo)指向時(shí)變背景顏色的表格
<table cellpading=0 cellspacing=1 bgcolor=red width=100 height=20><tr><td onmouseover="this.bgColor='#efefef'" onmouseout="this.bgColor='#333333'" bgcolor="#ffffff"></td></tr></table>
細(xì)線表格1:
<table cellpading=0 cellspacing=1 bgcolor=red width=100 height=20><tr><td bgcolor="#fffff"></td></tr></table>
細(xì)線表格2:
<table border=1 bordercolor="#000000" width=100 height=20><tr bordercolor="#ffffff"><td></td></tr></table>
細(xì)線表格3:
<input type="text" size=12 readonly="readonly">
<input type="text" size=12 disabled="disabled">
凹下的立體表格:
<table width="100" border="1" cellspacing="1" cellpadding="0" bgcolor=red>
<tr><td bgcolor="#ff3333"> </td><td bgcolor="#ff3333"> </td></tr>
<tr><td bgcolor="#ff3333"> </td><td bgcolor="#ff3333"> </td></tr>
<tr><td bgcolor="#ff3333"> </td><td bgcolor="#ff3333"> </td></tr>
</table>
凸出的立體表格:
<table width="100" border="1" cellspacing="0" cellpadding="0" bordercolorlight=#333333 bordercolordark=#efefef>
<tr><td bgcolor="#FF0000"> </td><td bgcolor="#FF0000"> </td></tr>
<tr><td bgcolor="#FF0000"> </td><td bgcolor="#FF0000"> </td></tr>
<tr><td bgcolor="#FF0000""> </td><td bgcolor="#FF0000"> </td></tr>
</table>
有間距的表格:
<table width="100" border="1" cellspacing="5" cellpadding="0" bgcolor=gray>
<tr><td bgcolor="#999999"> </td></tr>
</table>
<link rel="Shortcut Icon" href="favicon.ico"> IE地址欄前換成自己的圖標(biāo)
<link rel="Bookmark" href="favicon.ico"> 可以在收藏夾中顯示出你的圖標(biāo)
<input style="ime-mode:disabled"> 關(guān)閉中文輸入法
防止別人frame你的網(wǎng)頁(yè):
<script language="javascript">
if(top.location!=self.location){
top.location=self.location
}
</script>
1. oncontextmenu="window.event.returnValue=false" 將徹底屏蔽鼠標(biāo)右鍵
<table border oncontextmenu=return(false)><td>no</table> 可用于Table
2. <body onselectstart="return false"> 取消選取、防止復(fù)制
3. onpaste="return false" 不準(zhǔn)粘貼
4. oncopy="return false;" oncut="return false;" 防止復(fù)制
5. <link rel="Shortcut Icon" href="favicon.ico"> IE地址欄前換成自己的圖標(biāo)
6. <link rel="Bookmark" href="favicon.ico"> 可以在收藏夾中顯示出你的圖標(biāo)
7. <input style="ime-mode:disabled"> 關(guān)閉輸入法
8. 永遠(yuǎn)都會(huì)帶著框架
<script language="JavaScript"><!--
if (window == top)top.location.href = "frames.htm"; //frames.htm為框架網(wǎng)頁(yè)
// --></script>
9. 防止被人frame
<SCRIPT LANGUAGE=JAVASCRIPT><!--
if (top.location != self.location)top.location=self.location;
// --></SCRIPT>
10. 網(wǎng)頁(yè)將不能被另存為
<noscript><iframe src=*.html></iframe></noscript>
11. <input type=button value=查看網(wǎng)頁(yè)源代碼
onclick="window.location = 'view-source:'+ 'http://www.rwnh.cn/'">
12.刪除時(shí)確認(rèn)
<a href='javascript:if(confirm("確實(shí)要?jiǎng)h除嗎?"))location="boos.asp?&areyou=刪除&page=1"'>刪除</a>
<a href="return confirm("確認(rèn)刪除嗎?")"
13. 取得控件的絕對(duì)位置
//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>
14. 光標(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()">
15. 判斷上一頁(yè)的來(lái)源
javascript:document.referrer
16. 小化、大化、關(guān)閉窗口
<object id=hh1 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">
<param name="Command" value="Minimize"></object>
<object id=hh2 classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">
<param name="Command" value="Maximize"></object>
<OBJECT id=hh3 classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11">
<PARAM NAME="Command" VALUE="Close"></OBJECT>
<input type=button value=小化 onclick=hh1.Click()>
<input type=button value=大化 onclick=hh2.Click()>
<input type=button value=關(guān)閉 onclick=hh3.Click()>
本例適用于IE
17.屏蔽功能鍵Shift,Alt,Ctrl
<script>
function look(){
if(event.shiftKey)
alert("禁止按Shift鍵!"); //可以換成ALT CTRL
}
document.onkeydown=look;
</script>
18. 網(wǎng)頁(yè)不會(huì)被緩存
<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">
19.怎樣讓表單沒(méi)有凹凸感?
<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>
20.<div><span>&<layer>的區(qū)別?
<div>(division)用來(lái)定義大段的頁(yè)面元素,會(huì)產(chǎn)生轉(zhuǎn)行
<span>用來(lái)定義同一行內(nèi)的元素,跟<div>的唯一區(qū)別是不產(chǎn)生轉(zhuǎn)行
<layer>是ns的標(biāo)記,ie不支持,相當(dāng)于<div>
21.讓彈出窗口總是在后面:
<body onblur="this.focus();">
22.不要滾動(dòng)條?
讓豎條沒(méi)有:
<body style='overflow:scroll;overflow-y:hidden'>
</body>
讓橫條沒(méi)有:
<body style='overflow:scroll;overflow-x:hidden'>
</body>
兩個(gè)都去掉?更簡(jiǎn)單了
<body scroll="no">
</body>
23.怎樣去掉圖片鏈接點(diǎn)擊后,圖片周圍的虛線?
<a href="#" onFocus="this.blur()"><img src="logo.jpg" border=0></a>
24.電子郵件處理提交表單
<form name="form1" method="post" action="mailt****@***.com" enctype="text/plain">
<input type=submit>
</form>
25.在打開(kāi)的子窗口刷新父窗口的代碼里如何寫?
window.opener.location.reload()
26.如何設(shè)定打開(kāi)頁(yè)面的大小
<body onload="top.resizeTo(300,200);">
打開(kāi)頁(yè)面的位置<body onload="top.moveBy(300,200);">
27.在頁(yè)面中如何加入不是滿鋪的背景圖片,拉動(dòng)頁(yè)面時(shí)背景圖不動(dòng)
<STYLE>
body
{background-image:url(logo.gif); background-repeat:no-repeat;
background-position:center;background-attachment: fixed}
</STYLE>
28. 檢查一段字符串是否全由數(shù)字組成
<script language="Javascript"><!--
function checkNum(str){return str.match(//D/)==null}
alert(checkNum("1232142141"))
alert(checkNum("123214214a1"))
// --></script>
29. 獲得一個(gè)窗口的大小
document.body.clientWidth; document.body.clientHeight
30. 怎么判斷是否是字符
if (/[^/x00-/xff]/g.test(s)) alert("含有漢字");
else alert("全是字符");
31.TEXTAREA自適應(yīng)文字行數(shù)的多少
<textarea rows=1 name=s1 cols=27 onpropertychange="this.style.posHeight=this.scrollHeight">
</textarea>
32. 日期減去天數(shù)等于第二個(gè)日期
<script language=Javascript>
function cc(dd,dadd)
{
//可以加上錯(cuò)誤處理
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>
33. 選擇了哪一個(gè)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>
34.腳本永不出錯(cuò)
<SCRIPT LANGUAGE="JavaScript">
<!-- Hide
function killErrors() {
return true;
}
window.onerror = killErrors;
// -->
</SCRIPT>
35.ENTER鍵可以讓光標(biāo)移到下一個(gè)輸入框
<input onkeydown="if(event.keyCode==13)event.keyCode=9">
網(wǎng)頁(yè)標(biāo)題:發(fā)布一個(gè)以前學(xué)習(xí)html時(shí)候的總結(jié)
轉(zhuǎn)載注明:http://www.rwnh.cn/news15/258665.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供全網(wǎng)營(yíng)銷推廣、網(wǎng)站設(shè)計(jì)、網(wǎng)站改版、小程序開(kāi)發(fā)、虛擬主機(jī)、關(guān)鍵詞優(yōu)化
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容