Apologies for posting 2 days in a row (separate issues though). I have a webpage with a button and when that button is clicked, it opens a popup using ShowModalDialog.

In the window which pops-up, on the 'on load' event handler, I have the following code:

 Dim var As String = "var"

Dim wtitle As String = "Title - " + var + " [" + textbox.Text + "]"
    Dim s As New StringBuilder
    s.Append("<script type=""text/javaScript"">")
    s.Append("var wtitle = '" & wtitle & "';" & ControlChars.CrLf)
    s.Append("document.title = wtitle;" & ControlChars.CrLf)
    s.Append("</script>")

    If Not ClientScript.IsClientScriptBlockRegistered("GivePageTitle") Then
        ClientScript.RegisterClientScriptBlock(Me.GetType(), "GivePageTitle", s.ToString())
    End If

This code works fine on IE8. It also works on IE10. The problem is we need to support IE6 and the code does not seem to write the title correctly...it doesn't write it there at all. Is document.title support in ie6 or is there a different way I should be dynamically changing the window title?

Thanks, C

有帮助吗?

解决方案

Just do this in the pageload event

If Not IsPostback Then
    Page.Title = "The Title you want"
    .....
End If
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top