62,046
社区成员
发帖
与我相关
我的任务
分享
<table >
<tr>
<td valign="middle"><div align="center"><img alt="" id="face" src="" runat="server" /></div></td>
</tr>
</table>
<p align="center"> <select id="lstPic" name="lstPic" runat="server" onchange="document.images['face'].Src=options[selectedIndex].value;" >
</select>
选择头像</p>
public void InitlstPic()
{
string currentDir, fileName, imgDir;
FileInfo fi;
currentDir = Server.MapPath(".") + "\\pic\\gg";
imgDir = "pic\\gg";
女.Checked = false;
DirectoryInfo dir = new DirectoryInfo(currentDir);
foreach (FileSystemInfo fsi in dir.GetFileSystemInfos())
{
if (fsi is FileInfo)
{
fi = (FileInfo)fsi;
fileName = fi.Name;
if ((fi.Extension == ".gif") || (fi.Extension == ".jpg"))
lstPic.Items.Add(new ListItem(fileName, imgDir + "\\" + fileName));
}
}
lstPic.SelectedIndex = 0;
face.Src = lstPic.Value;
}