網(wǎng)頁設(shè)計常用的一些技巧
更新時間:2006年12月22日 00:00:00 作者:
各種用途的按鈕
<!--腳本說明:
把如下代碼加入<body>區(qū)域中:-->
<form>
<p>
<input type="button" value="返回" name="button" class="pt9">
<input TYPE="button" NAME="view" value="查看本例的源碼" view-source:" +window.location.href" class="pt9">
</p>
</form>
<form>
<p><input TYPE="button" value="返回上一步" ></p>
</form>
<form>
<p><input TYPE="button" value="刷新按鈕一" ></p>
</form>
<script language="javascript"><!--
function ReloadButton(){location.href="allbutton.htm";}
// --></script>
<form>
<p><input TYPE="button" value="刷新按鈕二" > </p>
</form>
<form>
<p><input TYPE="button" value="回首頁按鈕" ></p>
</form>
<script language="javascript"><!--
function HomeButton(){location.;}/ // --></script>
<form>
<p><input TYPE="button" value="彈出警告框" ></p>
</form>
<script language="javascript"><!--
function AlertButton(){window.alert("要多多光臨呀!");}
// --></script>
<form>
<p><input TYPE="button" value="狀態(tài)欄信息" ></p>
</form>
<script language="javascript"><!--
function StatusButton(){window.status="要多多光臨呀!";}
// --></script>
<form>
<p><input TYPE="button" value="背景色變換" ></p>
</form>
<script>function BgButton(){
if (document.bgColor=='#00ffff')
{document.bgColor='#ffffff';}
else{document.bgColor='#00ffff';}
} </script>
<form>
<p><input TYPE="button" value="打開新窗口" ></p>
</form>
<script language="javascript"><!--
function NewWindow(){window.open("test.htm","","height=240,width=340,status=no,location=no,toolbar=no,directories=no,menubar=no");}
// --></script>
個非常漂亮的下拉列表框
<HTML>
<HEAD>
<TITLE></TITLE>
<SCRIPT LANGUAGE=javascript>
function getSelected()
{ return hDDL.innerText
} function hDDL_onmousemove()
{ window.event.cancelBubble = true
}
function DDLI_onmousemove()
{ window.event.cancelBubble = true
}
function DDLI_onmouseover(item)
{ item.style.color = DDL_HFC
item.style.backgroundColor = DDL_HBC
}
function DDLI_onmouseout(item)
{ item.style.color = DDL_FGC
item.style.backgroundColor = DDL_BGC
}
function DDLI_onclick(item)
{ hDDL.innerText = item.innerText
DDL.style.display = "none"
alert("You click " + item.innerText + "!")
}
function document_onmousemove()
{ DDL.style.display = "none"
}
function DDL_onmousemove()
{ window.event.cancelBubble = true
}
function hDDL_onclick()
{ DDL.style.posLeft = hDDL.offsetLeft
DDL.style.posTop = hDDL.offsetTop + hDDL.offsetHeight
DDL.style.display = "block"
}
function writeDropdownList()
{
document.write("<SPAN id=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("<SPAN style="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("<DIV id=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(" >")
var i
for(i=0; i<DropdownListData.length; i++)
{ document.write("<SPAN id=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
var DropdownListData = new Array()
var DDL_BGC = "papayawhip"
var DDL_FGC = "green"
var DDL_HBC = "orange"
var DDL_HFC = "red"
var DDL_BC = "red"
var DDL_BW = 1
var DDL_Width = 90
var DDL_Top = 100
var DDL_Left = 80
var DDL_picW = 15
DropdownListData[0] = "Item0"
DropdownListData[1] = "Item1"
DropdownListData[2] = "Item2"
DropdownListData[3] = "Item3"
DropdownListData[4] = "Item4"
writeDropdownList()
</SCRIPT>
</HEAD>
<BODY>
<P><INPUT type="button" value="Selected" id=button1 name=button1
LANGUAGE=javascript
></P>
<P>下拉列表框演示程序:</P>
<LABEL id=l1>
</LABEL>
</BODY>
</HTML>
鼠標(biāo)右鍵絕對禁止法
softet
<script language="JavaScript">
<!--
if (window.Event)
document.captureEvents(Event.MOUSEUP);
function nocontextmenu()
{ event.cancelBubble = true
event.returnValue = false;
return false;
}
function norightclick(e)
{ if (window.Event)
{ if (e.which == 2 || e.which == 3)
return false;
} else
if (event.button == 2 || event.button == 3)
{
event.cancelBubble = true
event.returnValue = false;
return false;
}
}
document.oncontextmenu = nocontextmenu; // for IE5+
document.onmousedown = norightclick; // for all others
//-->
</script>
Dreamweaver定制網(wǎng)頁過渡功能:
首先用Dreamweaver打開頁面,然后單擊菜單中的Insert\Head\Meta(插入/文件頭標(biāo)簽/Meta).
在對話框中的Attribute選項的下拉列表中選HTTP-equivalent選項,在Value:中鍵入Page-Enter,表示進(jìn)入網(wǎng)頁時有網(wǎng)頁過渡效果。在Content:中鍵入Revealtrans(Duration=6,Transition=2),Duration=6表示網(wǎng)頁過渡效果的延續(xù)時間為6秒,Transition表示過渡效果方式,值為2時表示圓形收縮。
輸入完后單擊確定,存盤。這樣當(dāng)我們點擊一個超鏈接進(jìn)入這個頁面時就可以看到效果了。另外還有二十多種效供你選擇,只要將Transition的值改為相應(yīng)的效果的代號即可,具體效果和設(shè)置如下表所示:
效果 Content Transitionv
盒狀收縮 RevealTrans 0
盒狀展開 RevealTrans 1
圓形收縮 RevealTrans 2
圓形展開 RevealTrans 3
向上擦除 RevealTrans 4
向下擦除 RevealTrans 5
向左擦除 RevealTrans 6
向右擦除 RevealTrans 7
垂直百頁窗 RevealTrans 8
水平百頁窗 RevealTrans 9
橫向棋盤式 RevealTrans 10
縱向棋盤式 RevealTrans 11
溶解 RevealTrans 12
左右向中部收縮 RevealTrans 13
中部向左右展開 RevealTrans 14
上下向中部收縮 RevealTrans 15
中部向上下展開 RevealTrans 16
階梯狀向左下展開 RevealTrans 17
階梯狀向左上展開 RevealTrans 18
階梯狀向右下展開 RevealTrans 19
階梯狀向右上展開 RevealTrans 20
隨機(jī)水平線 RevealTrans 21
隨機(jī)垂直線 RevealTrans 22
隨機(jī) RevealTrans 23
加到文字中間,以顯示倒計時。
<script>
var url = "html/index.html"; {'html/index.html'為轉(zhuǎn)到頁面}
var loctime = 9; {9=9秒}
timedown.innerhtml = loctime;
var gourl = setInterval("downtimes()",1000);
function downtimes(){
loctime--;
timedown.innerHTML= loctime;
if(loctime <= 0){
clearInterval(gourl);
window.location = url;
}
}
</script>
然后把
<span id="timedown"></span>
又一個一個非常漂亮的下拉列表框
<HTML>
<HEAD>
<TITLE></TITLE>
<SCRIPT LANGUAGE=javascript>
function getSelected()
{ return hDDL.innerText
} function hDDL_onmousemove()
{ window.event.cancelBubble = true
}
function DDLI_onmousemove()
{ window.event.cancelBubble = true
}
function DDLI_onmouseover(item)
{ item.style.color = DDL_HFC
item.style.backgroundColor = DDL_HBC
}
function DDLI_onmouseout(item)
{ item.style.color = DDL_FGC
item.style.backgroundColor = DDL_BGC
}
function DDLI_onclick(item)
{ hDDL.innerText = item.innerText
DDL.style.display = "none"
alert("You click " + item.innerText + "!")
}
function document_onmousemove()
{ DDL.style.display = "none"
}
function DDL_onmousemove()
{ window.event.cancelBubble = true
}
function hDDL_onclick()
{ DDL.style.posLeft = hDDL.offsetLeft
DDL.style.posTop = hDDL.offsetTop + hDDL.offsetHeight
DDL.style.display = "block"
}
function writeDropdownList()
{
document.write("<SPAN id=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("<SPAN style="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("<DIV id=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(" >")
var i
for(i=0; i<DropdownListData.length; i++)
{ document.write("<SPAN id=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
var DropdownListData = new Array()
var DDL_BGC = "papayawhip"
var DDL_FGC = "green"
var DDL_HBC = "orange"
var DDL_HFC = "red"
var DDL_BC = "red"
var DDL_BW = 1
var DDL_Width = 90
var DDL_Top = 100
var DDL_Left = 80
var DDL_picW = 15
DropdownListData[0] = "Item0"
DropdownListData[1] = "Item1"
DropdownListData[2] = "Item2"
DropdownListData[3] = "Item3"
DropdownListData[4] = "Item4"
writeDropdownList()
</SCRIPT>
</HEAD>
<BODY>
<P><INPUT type="button" value="Selected" id=button1 name=button1
LANGUAGE=javascript
></P>
<P>下拉列表框演示程序:</P>
<LABEL id=l1>
</LABEL>
</BODY>
</HTML>
<!--腳本說明:
把如下代碼加入<body>區(qū)域中:-->
<form>
<p>
<input type="button" value="返回" name="button" class="pt9">
<input TYPE="button" NAME="view" value="查看本例的源碼" view-source:" +window.location.href" class="pt9">
</p>
</form>
<form>
<p><input TYPE="button" value="返回上一步" ></p>
</form>
<form>
<p><input TYPE="button" value="刷新按鈕一" ></p>
</form>
<script language="javascript"><!--
function ReloadButton(){location.href="allbutton.htm";}
// --></script>
<form>
<p><input TYPE="button" value="刷新按鈕二" > </p>
</form>
<form>
<p><input TYPE="button" value="回首頁按鈕" ></p>
</form>
<script language="javascript"><!--
function HomeButton(){location.;}/ // --></script>
<form>
<p><input TYPE="button" value="彈出警告框" ></p>
</form>
<script language="javascript"><!--
function AlertButton(){window.alert("要多多光臨呀!");}
// --></script>
<form>
<p><input TYPE="button" value="狀態(tài)欄信息" ></p>
</form>
<script language="javascript"><!--
function StatusButton(){window.status="要多多光臨呀!";}
// --></script>
<form>
<p><input TYPE="button" value="背景色變換" ></p>
</form>
<script>function BgButton(){
if (document.bgColor=='#00ffff')
{document.bgColor='#ffffff';}
else{document.bgColor='#00ffff';}
} </script>
<form>
<p><input TYPE="button" value="打開新窗口" ></p>
</form>
<script language="javascript"><!--
function NewWindow(){window.open("test.htm","","height=240,width=340,status=no,location=no,toolbar=no,directories=no,menubar=no");}
// --></script>
個非常漂亮的下拉列表框
<HTML>
<HEAD>
<TITLE></TITLE>
<SCRIPT LANGUAGE=javascript>
function getSelected()
{ return hDDL.innerText
} function hDDL_onmousemove()
{ window.event.cancelBubble = true
}
function DDLI_onmousemove()
{ window.event.cancelBubble = true
}
function DDLI_onmouseover(item)
{ item.style.color = DDL_HFC
item.style.backgroundColor = DDL_HBC
}
function DDLI_onmouseout(item)
{ item.style.color = DDL_FGC
item.style.backgroundColor = DDL_BGC
}
function DDLI_onclick(item)
{ hDDL.innerText = item.innerText
DDL.style.display = "none"
alert("You click " + item.innerText + "!")
}
function document_onmousemove()
{ DDL.style.display = "none"
}
function DDL_onmousemove()
{ window.event.cancelBubble = true
}
function hDDL_onclick()
{ DDL.style.posLeft = hDDL.offsetLeft
DDL.style.posTop = hDDL.offsetTop + hDDL.offsetHeight
DDL.style.display = "block"
}
function writeDropdownList()
{
document.write("<SPAN id=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("<SPAN style="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("<DIV id=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(" >")
var i
for(i=0; i<DropdownListData.length; i++)
{ document.write("<SPAN id=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
var DropdownListData = new Array()
var DDL_BGC = "papayawhip"
var DDL_FGC = "green"
var DDL_HBC = "orange"
var DDL_HFC = "red"
var DDL_BC = "red"
var DDL_BW = 1
var DDL_Width = 90
var DDL_Top = 100
var DDL_Left = 80
var DDL_picW = 15
DropdownListData[0] = "Item0"
DropdownListData[1] = "Item1"
DropdownListData[2] = "Item2"
DropdownListData[3] = "Item3"
DropdownListData[4] = "Item4"
writeDropdownList()
</SCRIPT>
</HEAD>
<BODY>
<P><INPUT type="button" value="Selected" id=button1 name=button1
LANGUAGE=javascript
></P>
<P>下拉列表框演示程序:</P>
<LABEL id=l1>
</LABEL>
</BODY>
</HTML>
鼠標(biāo)右鍵絕對禁止法
softet
<script language="JavaScript">
<!--
if (window.Event)
document.captureEvents(Event.MOUSEUP);
function nocontextmenu()
{ event.cancelBubble = true
event.returnValue = false;
return false;
}
function norightclick(e)
{ if (window.Event)
{ if (e.which == 2 || e.which == 3)
return false;
} else
if (event.button == 2 || event.button == 3)
{
event.cancelBubble = true
event.returnValue = false;
return false;
}
}
document.oncontextmenu = nocontextmenu; // for IE5+
document.onmousedown = norightclick; // for all others
//-->
</script>
Dreamweaver定制網(wǎng)頁過渡功能:
首先用Dreamweaver打開頁面,然后單擊菜單中的Insert\Head\Meta(插入/文件頭標(biāo)簽/Meta).
在對話框中的Attribute選項的下拉列表中選HTTP-equivalent選項,在Value:中鍵入Page-Enter,表示進(jìn)入網(wǎng)頁時有網(wǎng)頁過渡效果。在Content:中鍵入Revealtrans(Duration=6,Transition=2),Duration=6表示網(wǎng)頁過渡效果的延續(xù)時間為6秒,Transition表示過渡效果方式,值為2時表示圓形收縮。
輸入完后單擊確定,存盤。這樣當(dāng)我們點擊一個超鏈接進(jìn)入這個頁面時就可以看到效果了。另外還有二十多種效供你選擇,只要將Transition的值改為相應(yīng)的效果的代號即可,具體效果和設(shè)置如下表所示:
效果 Content Transitionv
盒狀收縮 RevealTrans 0
盒狀展開 RevealTrans 1
圓形收縮 RevealTrans 2
圓形展開 RevealTrans 3
向上擦除 RevealTrans 4
向下擦除 RevealTrans 5
向左擦除 RevealTrans 6
向右擦除 RevealTrans 7
垂直百頁窗 RevealTrans 8
水平百頁窗 RevealTrans 9
橫向棋盤式 RevealTrans 10
縱向棋盤式 RevealTrans 11
溶解 RevealTrans 12
左右向中部收縮 RevealTrans 13
中部向左右展開 RevealTrans 14
上下向中部收縮 RevealTrans 15
中部向上下展開 RevealTrans 16
階梯狀向左下展開 RevealTrans 17
階梯狀向左上展開 RevealTrans 18
階梯狀向右下展開 RevealTrans 19
階梯狀向右上展開 RevealTrans 20
隨機(jī)水平線 RevealTrans 21
隨機(jī)垂直線 RevealTrans 22
隨機(jī) RevealTrans 23
加到文字中間,以顯示倒計時。
<script>
var url = "html/index.html"; {'html/index.html'為轉(zhuǎn)到頁面}
var loctime = 9; {9=9秒}
timedown.innerhtml = loctime;
var gourl = setInterval("downtimes()",1000);
function downtimes(){
loctime--;
timedown.innerHTML= loctime;
if(loctime <= 0){
clearInterval(gourl);
window.location = url;
}
}
</script>
然后把
<span id="timedown"></span>
又一個一個非常漂亮的下拉列表框
<HTML>
<HEAD>
<TITLE></TITLE>
<SCRIPT LANGUAGE=javascript>
function getSelected()
{ return hDDL.innerText
} function hDDL_onmousemove()
{ window.event.cancelBubble = true
}
function DDLI_onmousemove()
{ window.event.cancelBubble = true
}
function DDLI_onmouseover(item)
{ item.style.color = DDL_HFC
item.style.backgroundColor = DDL_HBC
}
function DDLI_onmouseout(item)
{ item.style.color = DDL_FGC
item.style.backgroundColor = DDL_BGC
}
function DDLI_onclick(item)
{ hDDL.innerText = item.innerText
DDL.style.display = "none"
alert("You click " + item.innerText + "!")
}
function document_onmousemove()
{ DDL.style.display = "none"
}
function DDL_onmousemove()
{ window.event.cancelBubble = true
}
function hDDL_onclick()
{ DDL.style.posLeft = hDDL.offsetLeft
DDL.style.posTop = hDDL.offsetTop + hDDL.offsetHeight
DDL.style.display = "block"
}
function writeDropdownList()
{
document.write("<SPAN id=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("<SPAN style="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("<DIV id=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(" >")
var i
for(i=0; i<DropdownListData.length; i++)
{ document.write("<SPAN id=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
var DropdownListData = new Array()
var DDL_BGC = "papayawhip"
var DDL_FGC = "green"
var DDL_HBC = "orange"
var DDL_HFC = "red"
var DDL_BC = "red"
var DDL_BW = 1
var DDL_Width = 90
var DDL_Top = 100
var DDL_Left = 80
var DDL_picW = 15
DropdownListData[0] = "Item0"
DropdownListData[1] = "Item1"
DropdownListData[2] = "Item2"
DropdownListData[3] = "Item3"
DropdownListData[4] = "Item4"
writeDropdownList()
</SCRIPT>
</HEAD>
<BODY>
<P><INPUT type="button" value="Selected" id=button1 name=button1
LANGUAGE=javascript
></P>
<P>下拉列表框演示程序:</P>
<LABEL id=l1>
</LABEL>
</BODY>
</HTML>
相關(guān)文章
JavaScript網(wǎng)頁制作特殊效果用隨機(jī)數(shù)
JavaScript網(wǎng)頁制作特殊效果用隨機(jī)數(shù)...2007-05-05