WEB开发网
开发学院网页设计JavaScript 【推荐】一个非常漂亮的列表框 阅读

【推荐】一个非常漂亮的列表框

 2007-11-27 17:59:25 来源:WEB开发网   
核心提示:<HTML> <HEAD> <TITLE></TITLE> <SCRIPT LANGUAGE=javascript> function getSelected() { return LISTtext.innerText } function
<HTML>
<HEAD>
<TITLE></TITLE>
<SCRIPT LANGUAGE=javascript>
function getSelected()
{
return LISTtext.innerText
}

function LISTI_onmouseover(item)
{
LISTI0.style.color = LB_FGC
LISTI1.style.color = LB_FGC
LISTI2.style.color = LB_FGC
LISTI3.style.color = LB_FGC
LISTI4.style.color = LB_FGC

item.style.color = LB_HFC
}

function LISTI_onmouseout(item)
{
item.style.color = LB_FGC
}

function LISTI_onclick(item)
{
LISTI0.style.backgroundColor = LB_BGC
LISTI1.style.backgroundColor = LB_BGC
LISTI2.style.backgroundColor = LB_BGC
LISTI3.style.backgroundColor = LB_BGC
LISTI4.style.backgroundColor = LB_BGC
item.style.backgroundColor = LB_HBC
LISTtext.innerText = item.innerText
alert(You click + item.innerText + !)
}

function writeListbox()
{
document.write(<SPAN id=LISTtext style=\DISPLAY: none\></SPAN>)

document.write( <DIV id=LIST)
document.write( style =\BACKGROUND-COLOR: + LB_BGC + ;)
document.write( BORDER-BOTTOM: + LB_BC + + LB_BW + solid;)
document.write( BORDER-LEFT: + LB_BC + + LB_BW + solid;)
document.write( BORDER-RIGHT: + LB_BC + + LB_BW + solid;)
document.write( BORDER-TOP: + LB_BC + + LB_BW + solid;)
document.write( POSITION: absolute; HEIGHT: 99px;)
document.write( LEFT: + LB_Left + ; TOP: + LB_Top + ; WIDTH: + LB_Width + \>)
 var i
 for(i=0; i<ListboxData.length; i++)
 {
document.write(<SPAN id=LISTI + i)
document.write( style=\BACKGROUND-COLOR: + LB_BGC + ; CURSOR: hand;)
document.write( COLOR: + LB_FGC + ; PADDING-LEFT: 10px; WIDTH: + (LB_Width - 2 * LB_BW) + \)
document.write( LANGUAGE=\javascript\)
document.write( onmouseover=\return LISTI_onmouseover(LISTI + i + )\)
document.write( onmouseout=\return LISTI_onmouseout(LISTI + i + )\)
document.write( onclick=\return LISTI_onclick(LISTI + i + )\>)
document.write( + ListboxData[i] + </SPAN><BR>)
}
document.write(</DIV>)
}

var ListboxData = new Array()

var LB_BGC = papayawhip
var LB_FGC = green
var LB_HBC = orange
var LB_HFC = red
var LB_BC = red
var LB_BW = 1
var LB_Width = 90
var LB_Left = 80
var LB_Top = 100

ListboxData[0] = Item0
ListboxData[1] = Item1
ListboxData[2] = Item2
ListboxData[3] = Item3
ListboxData[4] = Item4

writeListbox()

</SCRIPT>
</HEAD>

<BODY>

<P><INPUT type=button value=Selected id=button1 name=button1
LANGUAGE=javascript
onclick=alert(You selected + LISTtext.innerText + !)></P>
<P>列表框演示程序:</P>

</BODY>
</HTML>

Tags:推荐 一个 非常

编辑录入:coldstar [复制链接] [打 印]
赞助商链接