7遇到的问题:
上传图片时实现即时预览
解决方法:
<script language="javascript">
function showimg()
{
document.all("image1").src=document.all("upfile").value;
}
</script>
…… ……
<input type="file" id="upfile" name="upfile" runat="server" onpropertychange="showimg()">
<asp:Image id="Image1" style="…… ……" runat="server"></asp:Image>
8遇到的问题:
关于web.config
解决方法:
在web.config存放数据库连接字符串:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSetings>
<add key = "test" value = "This is a test!"/>
<add key = "connString" value = …… ……/>
</appSettings>
<system.web>
</configuration>
在后台代码:
string appName = ConfigurationSettings.AppSettings["connString"];
this.Label1.Text = appName;
9遇到的问题:
关于为dropdownlist添加数据
解决方法:
方法一:
Dim strSQL As String = "select SName from Student"
Dim dbop As New DBoperation
Dim DS As New DataSet
DS = dbop.ExecuteDataset(strSQL, "table1")
Me.DropDownList1.DataSource = DS
Me.DropDownList1.DataTextField = "SName"
Me.DropDownList1.DataValueField = "SName" //可以text、value分别对应不同的列
Me.DropDownList1.DataBind()
方法二:
Dim strSQL As String = "select SName from Student"
Dim dbop As New DBoperation
Dim DR As SqlClient.SqlDataReader
DR = dbop.ExecuteReader(strSQL)
While DR.Read
Me.DropDownList1.Items.Add(New ListItem(CStr(DR.Item(0)), CStr(DR.Item(0))))
//可以text、value分别对应不同的列
End While
DR.Close()
0遇到的问题:
关于去除超链接的下划线
解决方法:
可写作:
在<head>与</head>之间加上
<style>
<!--
a:link {TEXT-DECORATION: none }
a:visited {TEXT-DECORATION: none }
a:active {TEXT-DECORATION: none }
a:hover {TEXT-DECORATION: none }
-->
</style>
这样的话该格式将应用于该页面所有的超链接
另:可以为该格式类取个名字:
如:
A.myLink:visited { TEXT-DECORATION: none }
A.myLink:link { COLOR: #3f3f3f; TEXT-DECORATION: none }
A.myLink:hover { TEXT-DECORATION: underline }
这样可以将该格式应用于某个特殊的类,如:
<a href="" class="myLink">…………</>