关于html的代码大全Word下载.docx

上传人:b****2 文档编号:4839697 上传时间:2023-05-04 格式:DOCX 页数:48 大小:39.97KB
下载 相关 举报
关于html的代码大全Word下载.docx_第1页
第1页 / 共48页
关于html的代码大全Word下载.docx_第2页
第2页 / 共48页
关于html的代码大全Word下载.docx_第3页
第3页 / 共48页
关于html的代码大全Word下载.docx_第4页
第4页 / 共48页
关于html的代码大全Word下载.docx_第5页
第5页 / 共48页
关于html的代码大全Word下载.docx_第6页
第6页 / 共48页
关于html的代码大全Word下载.docx_第7页
第7页 / 共48页
关于html的代码大全Word下载.docx_第8页
第8页 / 共48页
关于html的代码大全Word下载.docx_第9页
第9页 / 共48页
关于html的代码大全Word下载.docx_第10页
第10页 / 共48页
关于html的代码大全Word下载.docx_第11页
第11页 / 共48页
关于html的代码大全Word下载.docx_第12页
第12页 / 共48页
关于html的代码大全Word下载.docx_第13页
第13页 / 共48页
关于html的代码大全Word下载.docx_第14页
第14页 / 共48页
关于html的代码大全Word下载.docx_第15页
第15页 / 共48页
关于html的代码大全Word下载.docx_第16页
第16页 / 共48页
关于html的代码大全Word下载.docx_第17页
第17页 / 共48页
关于html的代码大全Word下载.docx_第18页
第18页 / 共48页
关于html的代码大全Word下载.docx_第19页
第19页 / 共48页
关于html的代码大全Word下载.docx_第20页
第20页 / 共48页
亲,该文档总共48页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

关于html的代码大全Word下载.docx

《关于html的代码大全Word下载.docx》由会员分享,可在线阅读,更多相关《关于html的代码大全Word下载.docx(48页珍藏版)》请在冰点文库上搜索。

关于html的代码大全Word下载.docx

embedsrc=音乐地址width=300height=45type=audio/mpegautostart="

false"

14)贴flash:

embedsrc="

flash地址"

width="

宽度"

height="

高度"

15)贴影视文件:

imgdynsrc="

文件地址"

start=mouseover>

16)换行:

br>

17)段落:

p>

段落<

/p>

18)原始文字样式:

pre>

正文<

/pre>

19)换帖子背景:

bodybackground="

背景图片地址"

20)固定帖子背景不随滚动条滚动:

body

bgproperties=fixed>

21)定制帖子背景颜色:

bodybgcolor="

(value值见10)

22)帖子背景音乐:

bgsound="

背景音乐地址"

loop=infinite>

23)贴网页:

iframesrc="

/iframe>

/----------------------------------------HTML特效代码--------------------------------/

1。

忽视右键

 <

bodyoncontextmenu="

returnfalse"

 或

bodystyle="

overflow-y:

hidden"

2。

加入背景音乐

 IE:

bgsoundsrc="

*.mid"

 NS:

autostart=truehidden=trueloop=true>

/embed>

 *.mid你的背景音乐的midi格式文件

3。

简单的window.open方法

#"

 onclick="

javascript:

window.open(文件路径/文件名,newwindow,

 toolbar=no,scrollbars=yes,resizable=no,top=0,left=0,

 width=400,height=300);

"

文字或图片<

 参数解释:

SCRIPTLANGUAGE="

javascript"

js脚本开始;

 window.open弹出新窗口的命令;

 文件路径/文件名弹出窗口的文件名;

 newwindow弹出窗口的名字(不是文件名),非必须,可用空代替;

 width=400窗口宽度;

 height=300窗口高度;

 top=0窗口距离屏幕上方的象素值;

 left=0窗口距离屏幕左侧的象素值;

 toolbar=no是否显示工具栏,yes为显示;

 menubar,scrollbars表示菜单栏和滚动栏。

 resizable=no是否允许改变窗口大小,yes为允许;

 location=no是否显示地址栏,yes为允许;

 status=no是否显示状态栏内的信息(通常是文件已经打开),yes为允许;

/SCRIPT>

js脚本结束

4。

简单的页面加密

scriptLANGUAGE="

!

--

 functionloopy(){

  varsWord="

;

  while(sWord!

="

login"

){sWord=prompt("

请输入你的登陆密码"

);

}

  alert("

登陆成功!

 }

 loopy()

 //-->

/script>

5。

拉动页面时背景图不动

style>

 body{background-image:

url(logo.gif);

 background-repeat:

no-repeat;

background-position:

center}

/style>

6。

让浏览器在保存页面时保存失败

NOSCRIPT>

*.html"

/NOSCRIPT>

7。

随机替换图片

script>

 document.write(<

img/+parseInt(Math.random()*(5))

 +.gif"

height="

40"

50"

 图片文件名为0.gif1.gif2.gif3.gif4.gif

8。

窗口定时关闭

 先将如下代码网页文件的区:

scriptlanguage="

 functioncloseit(){setTimeout("

self.close()"

10000)//毫秒}

 然后再在<

body>

标内加入如:

bodyonload="

closeit()"

9。

网页自动关闭

html>

head>

objectid=closestype="

application/x-oleobject"

 classid="

clsid:

adb880a6-d8ff-11cf-9377-00aa003b7a11"

paramname="

Command"

value="

Close"

/object>

/head>

window.setTimeout(closes.Click(),10000)"

 这个窗口会在10秒过后自动关闭,而且不会出现提示.

/body>

/html>

10。

网页自动刷新

 在head部记入

METAHTTP-EQUIV="

Refresh"

content="

20"

 其中20为20秒后自动刷新,你可以更改为任意值。

11。

网页自动转页

CONTENT="

时间(秒);

URL=地址"

12。

保持layer在最前面,而不被Iframe、Object所覆盖

 在Layer中再插Iframe或Object设z-Index值

divz-Index:

2>

objectxxx>

#前面

1>

#后面

divid="

Layer2"

position:

absolute;

top:

40;

width:

400px;

 height:

95px;

z-index:

2"

height=100%width=100%>

iframewidth=0height=0>

/div>

Layer1"

50;

200px;

115px;

1"

iframeheight=100%width=100%>

13。

返回上一页

ahref=javascript:

history.back

(1)>

『返回上一页』<

14。

关闭窗口

self.close()>

『关闭窗口』<

15。

关于iframe的透明背景

IFRAMEID="

iFrame1"

SRC="

iframe.htm"

 allowTransparency="

true"

 style="

background-color:

green"

/IFRAME>

16.oncontextmenu="

window.event.returnValue=false"

将彻底屏蔽鼠标右键

tableborderoncontextmenu=return(false)>

td>

no<

/table>

可用于Table

17.<

bodyonselectstart="

取消选取、防止复制

18.onpaste="

不准粘贴

19.oncopy="

returnfalse;

oncut="

防止复制

20.<

linkrel="

ShortcutIcon"

href="

favicon.ico"

IE地址栏前换成自己的图标

21.<

Bookmark"

可以在收藏夹中显示出你的图标

22.<

inputstyle="

ime-mode:

disabled"

关闭输入法

23.永远都会带着框架

JavaScript"

if(window==top)top.location.href="

frames.htm"

//frames.htm为框架网页

//-->

24.防止被人frame

SCRIPTLANGUAGE=JAVASCRIPT>

if(top.location!

=self.location)top.location=self.location;

25.网页将不能被另存为

noscript>

iframesrc=*.html>

/noscript>

26.查看网页源代码

inputtype=buttonvalue=查看网页源代码onclick="

window.location="

view-source:

+"

27.删除时确认

if(confirm("

确实要删除吗?

))location="

boos.asp?

&

areyou=删除&

page=1"

删除<

28.屏蔽功能键Shift,Alt,Ctrl

functionlook(){

if(event.shiftKey)

alert("

禁止按Shift键!

//可以换成ALT CTRL

document.onkeydown=look;

29.网页不会被缓存

pragma"

no-cache"

Cache-Control"

no-cache,must-revalidate"

expires"

Wed,26Feb199708:

21:

57GMT"

或者<

0"

30.怎样让表单没有凹凸感?

inputtype=textstyle="

border:

1solid#000000"

或<

border-left:

none;

border-right:

border-top:

border-bottom:

1solid#000000"

/textarea>

31.不要滚动条?

让竖条没有:

overflow:

scroll;

让横条没有:

overflow-x:

两个都去掉?

更简单了

bodyscroll="

no"

32.怎样去掉图片链接点击后,图片周围的虚线?

onFocus="

this.blur()"

logo.jpg"

border=0>

33.电子邮件处理提交表单

formname="

form1"

method="

post"

action="

mailt****@***.com"

enctype="

text/plain"

inputtype=submit>

/form>

34.在打开的子窗口刷新父窗口的代码里如何写?

window.opener.location.reload()

35.如何设定打开页面的大小

top.resizeTo(300,200);

打开页面的位置<

top.moveBy(300,200);

36.在页面中如何加入不是满铺的背景图片,拉动页面时背景图不动

STYLE>

body

{background-image:

background-repeat:

center;

background-attachment:

fixed}

/STYLE>

37.检查一段字符串是否全由数字组成

Javascript"

functioncheckNum(str){returnstr.match(//D/)==null}

alert(checkNum("

1232142141"

))

123214214a1"

38.获得一个窗口的大小

document.body.clientWidth;

document.body.clientHeight

39.怎么判断是否是字符

if(/[^/x00-/xff]/g.test(s))alert("

含有汉字"

elsealert("

全是字符"

40.TEXTAREA自适应文字行数的多少

textarearows=1name=s1cols=27onpropertychange="

this.style.posHeight=this.scrollHeight"

41.日期减去天数等于第二个日期

scriptlanguage=Javascript>

functioncc(dd,dadd)

{

//可以加上错误处理

vara=newDate(dd)

a=a.valueOf()

a=a-dadd*24*60*60*1000

a=newDate(a)

alert(a.getFullYear()+"

年"

+(a.getMonth()+1)+"

月"

+a.getDate()+"

日"

}cc("

12/23/2002"

2)

42.选择了哪一个Radio

HTML>

vbscript"

functioncheckme()

foreachobinradio1

ifob.checkedthenwindow.alertob.value

next

endfunction

BODY>

INPUTname="

radio1"

type="

radio"

style"

checked>

Style

barcode"

Barcode

INPUTtype="

button"

check"

onclick="

checkme()"

/BODY>

/HTML>

43.脚本永不出错

--HidefunctionkillErrors(){returntrue;

}window.onerror=killErrors;

//-->

44.ENTER键可以让光标移到下一个输入框

inputonkeydown="

if(event.keyCode==13)event.keyCode=9"

45.检测某个网站的链接速度:

把如下代码加入<

区域中:

tim=1

setInterval("

tim++"

100)

b=1

varautourl=newArray()

autourl[1]="

autourl[2]="

autourl[3]="

autourl[4]="

autourl[5]="

functionbutt(){

document.write("

formname=autof>

for(vari=1;

i<

autourl.length;

i++)

inputtype=textname=txt"

+i+"

size=10value=测试中

……>

=》<

inputtype=text

name=url"

size=40>

inputtype=buttonvalue=GO

onclick=window.open(this.form.url"

.value)>

inputtype=submitvalue=刷新>

butt()

functionauto(url){

document.forms[0]["

url"

+b].value=url

if(tim>

200)

{document.forms[0]["

txt"

+b].value="

链接超时"

else

时间"

+tim/10+"

秒"

}b++}

functionrun(){for(vari=1;

i++)document.write("

imgsrc=http:

//"

+autourl+"

/"

+Math.random()+"

width=1height=1nerror=auto("

http:

)>

)}

run()<

46.各种样式的光标

auto:

标准光标

default:

标准箭头

hand:

手形光标

wait:

等待光标

text:

I形光标

vertical-text:

水平I形光标

no-drop:

不可拖动光标

not-allowed:

无效光标

help:

?

帮助光标

all-scroll:

三角方向标

move:

移动标

crosshair:

十字标

e-resize

n-resize

nw-resize

w-resize

s-resize

se-resize

sw-resize

47、禁止鼠标右键,把Demo的图片全都设为表格的背景,表格的大小与图片的大小一样。

这样做看起来是一样的,主要是防止鼠标经过图片时会出现另存的按钮。

禁止鼠标右键的代码很简单:

functionclick(){if(event.button==2)

{alert(呵呵,不好意思,你甭想使用右键下载图片:

));

}}document.onmousedown=click

48、在网页的Head部分加入如下代码,这段代码的主要功能是屏蔽PrintScreen键,不断清空剪贴版,防止图片被用文件——另存为菜单另存。

--

functiontestclip(){

try{

if(clipboardData.getData("

Text"

)||clipboardData.getData("

HTML"

URL"

{

null;

}

catch(e){

clipboardData.setData("

"

setTimeout("

testclip()"

500)

testclip();

//-->

////////////////////////////////////////////////////////////////////

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 解决方案 > 学习计划

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2