所以,我知道如何在谷歌中创建弹出窗口,我知道如何在弹出窗口中编写,但如何在弹出窗口中放入其他HTML标签?
我的Html代码如下。
<p>
正如您所看到的,在document.write函数中,我有两个<button>
标记,我也可以使用<script>
标记,但我无法使用Private Sub dataGridView_MouseClick(ByVal sender As Object,
ByVal e As System.Windows.Forms.MouseEventArgs
) Handles Me.MouseClick
If e.Button = Forms.MouseButtons.Right Then
Dim m As New Forms.ContextMenu()
Dim hi As HitTestInfo = Me.HitTest(e.X, e.Y)
If hi.RowIndex >= 0 Then
m.MenuItems.Add(New Forms.MenuItem("Insert Line", AddressOf CType(Application.Current.MainWindow, MainWindow).menuFEInsertLine_Click))
End If
If hi.ColumnIndex >= 0 Then
If hi.RowIndex >= 0 Then
m.MenuItems.Add("-")
End If
m.MenuItems.Add(New Forms.MenuItem("Insert Column", AddressOf CType(Application.Current.MainWindow, MainWindow).menuFEInsertColumn_Click))
End If
m.Show(Me, New System.Drawing.Point(e.X, e.Y))
End If
End Sub
Private Sub dataGridView_MouseMove(ByVal sender As Object,
ByVal e As System.Windows.Forms.MouseEventArgs
) Handles Me.MouseMove
Try
Dim hi As HitTestInfo = Me.HitTest(e.X, e.Y)
If hi IsNot Nothing Then
Me.SetCurrentCellAddressCore(hi.ColumnIndex, hi.RowIndex, False, False, False)
End If
Catch ex As System.ArgumentOutOfRangeException
End Try
End Sub
标记,有谁知道为什么,或者是否可能?
答案 0 :(得分:0)
所以你试图在弹出窗口中写一个<script>
标签?你必须这样做:
<html>
<head>
<script>
function openWin()
{
myWindow=window.open("","","width=200,height=100");
myWindow.document.open();
myWindow.document.write("<p>NEW WINDOW<p>");
myWindow.document.write("<scr" + "ipt>alert('Script works!')</scr"+"ipt>");
myWindow.document.close();
}
</script>
</head>
<body>
<button onmousedown='openWin();'>Hello</button>
</body>
</html>
否则,父窗口会认为脚本标记是它应该解释的内容。
答案 1 :(得分:-1)
你不能写“&lt; script&gt;”或“&lt; / script&gt;”到窗口,这些是特别禁止的。你必须拆分这些条款。
function openWin() {
myWindow=window.open("","","width=200,height=100");
myWindow.document.write("<p>NEW WINDOW<p>");
myWindow.document.write("<scr");
myWindow.document.write("ipt>alert('Script works!')</scr")
myWindow.document.write("ipt>");
}