asp select下拉菜單選擇圖標并實時顯示
2024-05-04 11:00:28
供稿:網友
靜態方法:將下面的代碼復制到<body>~</body>內
程序代碼
<table cellpadding="2" width="226" cellspacing="2" border="0" >
<tr>
<td width="32" align="right"><img id=idface src="..../../../bbs/images/icon/1.gif" alt=個人形象代表 width="32" height="32"></td>
<td width="30" ><font class=cha2>頭像</font></td>
<td width="69">
<select class=editbox1 onChange="document.images['idface'].src=options[selectedIndex].value;">
<option value=../../../bbs/images/icon/1.gif selected>頭像1</option>
<option value=../../../bbs/images/icon/2.gif select>頭像2</option>
<option value=../../../bbs/images/icon/3.gif select>頭像3</option>
<option value=../../../bbs/images/icon/4.gif select>頭像4</option>
<option value=../../../bbs/images/icon/5.gif select>頭像5</option>
<option value=../../../bbs/images/icon/6.gif select>頭像6</option>
<option value=../../../bbs/images/icon/7.gif select>頭像7</option>
<option value=../../../bbs/images/icon/8.gif select>頭像8</option>
<option value=../../../bbs/images/icon/9.gif select>頭像9</option>
<option value=../../../bbs/images/icon/10.gif select>頭像10</option>
<option value=../../../bbs/images/icon/11.gif select>頭像11</option>
<option value=../../../bbs/images/icon/12.gif select>頭像12</option>
<option value=../../../bbs/images/icon/13.gif select>頭像13</option>
<option value=../../../bbs/images/icon/14.gif select>頭像14</option>
<option value=../../../bbs/images/icon/15.gif select>頭像15</option>
<option value=../../../bbs/images/icon/16.gif select>頭像16</option>
<option value=../../../bbs/images/icon/17.gif select>頭像17</option>
<option value=../../../bbs/images/icon/18.gif select>頭像18</option>
<option value=../../../bbs/images/icon/19.gif select>頭像19</option>
<option value=../../../bbs/images/icon/20.gif select>頭像20</option>
</select>
</td>
<td width="69">--> 靜態</td>
</tr>
</table>
ASP數組方法:將下面的代碼復制到<body>~</body>內
程序代碼
<table cellpadding="2" width="241" cellspacing="2" border="0" >
<tr>
<td width="32" align="right"><img id=idface1 src="..../../../bbs/images/icon/1.gif" alt=個人形象代表 width="32" height="32"></td>
<td width="30" ><font class=cha2>頭像</font></td>
<td width="62">
<select onChange="document.images['idface1'].src=options[selectedIndex].value;" class="editbox1" >
<%
dim i
for i=1 to 20
%>
<option select value="../../../bbs/images/icon/<%=I%>.gif">頭像<%=I%></option>