我正在使用以下函数在使用VB.Net的代码中动态添加html div和image标签。
Public Sub GetUserPictures(ByVal gifId As String)
Dim ds As New DataSet
Dim user = New FacebookUser
ds = user.GetUserImagesByUserId(UserID, New Guid(gifId))
Dim gImg As Integer
If (ds.Tables(0).Rows.Count > 0) Then
For i = 0 To ds.Tables(0).Rows.Count - 1
defaultIcons.InnerHtml = ""
gImg = Convert.ToInt64(ds.Tables(0).Rows(i).Item("Id"))
imageContainer.InnerHtml += "<div class='FunnyFace' style='cursor: pointer'><img id='" + Convert.ToString(gImg) + "' src='" + ds.Tables(0).Rows(i).Item("ImagePath") + "' width='86' height='103' onclick = 'SetImage('" + Convert.ToString(gImg) + "');' /></div>"
'img1.Src = ds.Tables(0).Rows(i).Item("ImagePath")
Next
End If
End Sub
但在浏览器上显示页面时,html如下所示:
<div style="cursor: pointer" class="FunnyFace"><img width="86" height="103" 28');'="" onclick="SetImage(" src="/content/images/ID1.png" id="28"></div>
我做错了吗?