网页设计常用的一些技巧
网页设计常用的一些技巧
发布时间:2016-12-30 来源:查字典编辑
摘要:各种用途的按钮functionBgButton(){if(document.bgColor=='#00ffff'){document.bgC...

各种用途的按钮

<>

<form>

<p>

<inputtype="button"value="返回"name="button"class="pt9">

<inputTYPE="button"NAME="view"value="查看本例的源码"view-source:"+window.location.href"class="pt9">

</p>

</form>

<form>

<p><inputTYPE="button"value="返回上一步"></p>

</form>

<form>

<p><inputTYPE="button"value="刷新按钮一"></p>

</form>

<scriptlanguage="javascript"><></script>

<form>

<p><inputTYPE="button"value="刷新按钮二"></p>

</form>

<form>

<p><inputTYPE="button"value="回首页按钮"></p>

</form>

<scriptlanguage="javascript"><></script>

<form>

<p><inputTYPE="button"value="弹出警告框"></p>

</form>

<scriptlanguage="javascript"><></script>

<form>

<p><inputTYPE="button"value="状态栏信息"></p>

</form>

<scriptlanguage="javascript"><></script>

<form>

<p><inputTYPE="button"value="背景色变换"></p>

</form>

<script>functionBgButton(){

if(document.bgColor=='#00ffff')

{document.bgColor='#ffffff';}

else{document.bgColor='#00ffff';}

}</script>

<form>

<p><inputTYPE="button"value="打开新窗口"></p>

</form>

<scriptlanguage="javascript"><></script>

个非常漂亮的下拉列表框

<HTML>

<HEAD>

<TITLE></TITLE>

<SCRIPTLANGUAGE=javascript>

functiongetSelected()

{returnhDDL.innerText

}functionhDDL_onmousemove()

{window.event.cancelBubble=true

}

functionDDLI_onmousemove()

{window.event.cancelBubble=true

}

functionDDLI_onmouseover(item)

{item.style.color=DDL_HFC

item.style.backgroundColor=DDL_HBC

}

functionDDLI_onmouseout(item)

{item.style.color=DDL_FGC

item.style.backgroundColor=DDL_BGC

}

functionDDLI_onclick(item)

{hDDL.innerText=item.innerText

DDL.style.display="none"

alert("Youclick"+item.innerText+"!")

}

functiondocument_onmousemove()

{DDL.style.display="none"

}

functionDDL_onmousemove()

{window.event.cancelBubble=true

}

functionhDDL_onclick()

{DDL.style.posLeft=hDDL.offsetLeft

DDL.style.posTop=hDDL.offsetTop+hDDL.offsetHeight

DDL.style.display="block"

}

functionwriteDropdownList()

{

document.write("<SPANid=hDDL")

document.write("style="BACKGROUND-COLOR:"+DDL_BGC+";")

document.write("BORDER-BOTTOM:"+DDL_BC+""+DDL_BW+"solid;")

document.write("BORDER-LEFT:"+DDL_BC+""+DDL_BW+"solid;")

document.write("BORDER-RIGHT:"+DDL_BC+""+DDL_BW+"solid;")

document.write("BORDER-TOP:"+DDL_BC+""+DDL_BW+"solid;")

document.write("PADDING-LEFT:10px;COLOR:"+DDL_FGC+";")

document.write("CURSOR:hand;POSITION:absolute;")

document.write("LEFT:"+DDL_Left+";TOP:"+DDL_Top+";WIDTH:"+DDL_Width+""")document.write("LANGUAGE="javascript"")

document.write("")

document.write(">")

document.write(DropdownListData[0]+"</SPAN>")

document.write("<SPANstyle="BACKGROUND-COLOR:"+DDL_BGC+";")

document.write("BACKGROUND-IMAGE:url(imageDDLpic.gif);CURSOR:hand;")document.write("POSITION:absolute;TOP:"+(DDL_Top+DDL_BW)+";")document.write("LEFT:"+(DDL_Left+DDL_Width-DDL_BW-DDL_picW)+";")document.write("WIDTH:"+DDL_picW+";")

document.write("BACKGROUND-REPEAT:no-repeat"")

document.write("LANGUAGE="javascript"")

document.write("")

document.write(">")

document.write("</SPAN>")

document.write("<DIVid=DDL")

document.write("style="BACKGROUND-COLOR:"+DDL_BGC+";")

document.write("BORDER-BOTTOM:"+DDL_BC+""+DDL_BW+"solid;")

document.write("BORDER-LEFT:"+DDL_BC+""+DDL_BW+"solid;")

document.write("BORDER-RIGHT:"+DDL_BC+""+DDL_BW+"solid;")

document.write("BORDER-TOP:"+DDL_BC+""+DDL_BW+"solid;")

document.write("DISPLAY:none;POSITION:absolute;")

document.write("LEFT:10px;HEIGHT:99px;TOP:124px;WIDTH:"+DDL_Width+""")document.write("LANGUAGE="javascript"")

document.write(">")

vari

for(i=0;i<DropdownListData.length;i++)

{document.write("<SPANid=DDLI"+i)

document.write("style="BACKGROUND-COLOR:"+DDL_BGC+";CURSOR:hand;")document.write("COLOR:"+DDL_FGC+";PADDING-LEFT:10px;WIDTH:"+(DDL_Width-2*DDL_BW)+""")document.write("LANGUAGE="javascript"")

document.write("+i+")"")document.write("+i+")"")

document.write("+i+")"")

document.write(">")

document.write(DropdownListData+"</SPAN><BR>")

}document.write("</DIV>")

}

document.onmousemove=document_onmousemove

varDropdownListData=newArray()

varDDL_BGC="papayawhip"

varDDL_FGC="green"

varDDL_HBC="orange"

varDDL_HFC="red"

varDDL_BC="red"

varDDL_BW=1

varDDL_Width=90

varDDL_Top=100

varDDL_Left=80

varDDL_picW=15

DropdownListData[0]="Item0"

DropdownListData[1]="Item1"

DropdownListData[2]="Item2"

DropdownListData[3]="Item3"

DropdownListData[4]="Item4"

writeDropdownList()

</SCRIPT>

</HEAD>

<BODY>

<P><INPUTtype="button"value="Selected"id=button1name=button1

LANGUAGE=javascript

></P>

<P>下拉列表框演示程序:</P>

<LABELid=l1>

</LABEL>

</BODY>

</HTML>

鼠标右键绝对禁止法

softet

<scriptlanguage="JavaScript">

<>

</script>

Dreamweaver定制网页过渡功能:

首先用Dreamweaver打开页面,然后单击菜单中的InsertHeadMeta(插入/文件头标签/Meta).

在对话框中的Attribute选项的下拉列表中选HTTP-equivalent选项,在Value:中键入Page-Enter,表示进入网页时有网页过渡效果。在Content:中键入Revealtrans(Duration=6,Transition=2),Duration=6表示网页过渡效果的延续时间为6秒,Transition表示过渡效果方式,值为2时表示圆形收缩。

输入完后单击确定,存盘。这样当我们点击一个超链接进入这个页面时就可以看到效果了。另外还有二十多种效供你选择,只要将Transition的值改为相应的效果的代号即可,具体效果和设置如下表所示:

效果ContentTransitionv

盒状收缩RevealTrans0

盒状展开RevealTrans1

圆形收缩RevealTrans2

圆形展开RevealTrans3

向上擦除RevealTrans4

向下擦除RevealTrans5

向左擦除RevealTrans6

向右擦除RevealTrans7

垂直百页窗RevealTrans8

水平百页窗RevealTrans9

横向棋盘式RevealTrans10

纵向棋盘式RevealTrans11

溶解RevealTrans12

左右向中部收缩RevealTrans13

中部向左右展开RevealTrans14

上下向中部收缩RevealTrans15

中部向上下展开RevealTrans16

阶梯状向左下展开RevealTrans17

阶梯状向左上展开RevealTrans18

阶梯状向右下展开RevealTrans19

阶梯状向右上展开RevealTrans20

随机水平线RevealTrans21

随机垂直线RevealTrans22

随机RevealTrans23

加到文字中间,以显示倒计时。

<script>

varurl="html/index.html";{'html/index.html'为转到页面}

varloctime=9;{9=9秒}

timedown.innerhtml=loctime;

vargourl=setInterval("downtimes()",1000);

functiondowntimes(){

loctime--;

timedown.innerHTML=loctime;

if(loctime<=0){

clearInterval(gourl);

window.location=url;

}

}

</script>

然后把

<spanid="timedown"></span>

又一个一个非常漂亮的下拉列表框

<HTML>

<HEAD>

<TITLE></TITLE>

<SCRIPTLANGUAGE=javascript>

functiongetSelected()

{returnhDDL.innerText

}functionhDDL_onmousemove()

{window.event.cancelBubble=true

}

functionDDLI_onmousemove()

{window.event.cancelBubble=true

}

functionDDLI_onmouseover(item)

{item.style.color=DDL_HFC

item.style.backgroundColor=DDL_HBC

}

functionDDLI_onmouseout(item)

{item.style.color=DDL_FGC

item.style.backgroundColor=DDL_BGC

}

functionDDLI_onclick(item)

{hDDL.innerText=item.innerText

DDL.style.display="none"

alert("Youclick"+item.innerText+"!")

}

functiondocument_onmousemove()

{DDL.style.display="none"

}

functionDDL_onmousemove()

{window.event.cancelBubble=true

}

functionhDDL_onclick()

{DDL.style.posLeft=hDDL.offsetLeft

DDL.style.posTop=hDDL.offsetTop+hDDL.offsetHeight

DDL.style.display="block"

}

functionwriteDropdownList()

{

document.write("<SPANid=hDDL")

document.write("style="BACKGROUND-COLOR:"+DDL_BGC+";")

document.write("BORDER-BOTTOM:"+DDL_BC+""+DDL_BW+"solid;")

document.write("BORDER-LEFT:"+DDL_BC+""+DDL_BW+"solid;")

document.write("BORDER-RIGHT:"+DDL_BC+""+DDL_BW+"solid;")

document.write("BORDER-TOP:"+DDL_BC+""+DDL_BW+"solid;")

document.write("PADDING-LEFT:10px;COLOR:"+DDL_FGC+";")

document.write("CURSOR:hand;POSITION:absolute;")

document.write("LEFT:"+DDL_Left+";TOP:"+DDL_Top+";WIDTH:"+DDL_Width+""")document.write("LANGUAGE="javascript"")

document.write("")

document.write(">")

document.write(DropdownListData[0]+"</SPAN>")

document.write("<SPANstyle="BACKGROUND-COLOR:"+DDL_BGC+";")

document.write("BACKGROUND-IMAGE:url(imageDDLpic.gif);CURSOR:hand;")document.write("POSITION:absolute;TOP:"+(DDL_Top+DDL_BW)+";")document.write("LEFT:"+(DDL_Left+DDL_Width-DDL_BW-DDL_picW)+";")document.write("WIDTH:"+DDL_picW+";")

document.write("BACKGROUND-REPEAT:no-repeat"")

document.write("LANGUAGE="javascript"")

document.write("")

document.write(">")

document.write("</SPAN>")

document.write("<DIVid=DDL")

document.write("style="BACKGROUND-COLOR:"+DDL_BGC+";")

document.write("BORDER-BOTTOM:"+DDL_BC+""+DDL_BW+"solid;")

document.write("BORDER-LEFT:"+DDL_BC+""+DDL_BW+"solid;")

document.write("BORDER-RIGHT:"+DDL_BC+""+DDL_BW+"solid;")

document.write("BORDER-TOP:"+DDL_BC+""+DDL_BW+"solid;")

document.write("DISPLAY:none;POSITION:absolute;")

document.write("LEFT:10px;HEIGHT:99px;TOP:124px;WIDTH:"+DDL_Width+""")document.write("LANGUAGE="javascript"")

document.write(">")

vari

for(i=0;i<DropdownListData.length;i++)

{document.write("<SPANid=DDLI"+i)

document.write("style="BACKGROUND-COLOR:"+DDL_BGC+";CURSOR:hand;")document.write("COLOR:"+DDL_FGC+";PADDING-LEFT:10px;WIDTH:"+(DDL_Width-2*DDL_BW)+""")document.write("LANGUAGE="javascript"")

document.write("+i+")"")document.write("+i+")"")

document.write("+i+")"")

document.write(">")

document.write(DropdownListData+"</SPAN><BR>")

}document.write("</DIV>")

}

document.onmousemove=document_onmousemove

varDropdownListData=newArray()

varDDL_BGC="papayawhip"

varDDL_FGC="green"

varDDL_HBC="orange"

varDDL_HFC="red"

varDDL_BC="red"

varDDL_BW=1

varDDL_Width=90

varDDL_Top=100

varDDL_Left=80

varDDL_picW=15

DropdownListData[0]="Item0"

DropdownListData[1]="Item1"

DropdownListData[2]="Item2"

DropdownListData[3]="Item3"

DropdownListData[4]="Item4"

writeDropdownList()

</SCRIPT>

</HEAD>

<BODY>

<P><INPUTtype="button"value="Selected"id=button1name=button1

LANGUAGE=javascript

></P>

<P>下拉列表框演示程序:</P>

<LABELid=l1>

</LABEL>

</BODY>

</HTML>

推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
相关阅读
网友关注
最新Javascript教程学习
热门Javascript教程学习
编程开发子分类