假设代码后面的字符串变量包含一些HTML内容,例如
override func viewWillTransitionToSize(size: CGSize, withTransitionCoordinator coordinator: UIViewControllerTransitionCoordinator) {
if UIDevice.currentDevice().orientation.isLandscape.boolValue {
patch.hidden = true
} else {
patch.hidden = false
}
}
可以通过注册诸如
之类的脚本来打开保存的文件string.matches("something[0-9]x")
有没有办法在新的标签页或窗口中输出后面的代码而不将其保存到文件?
答案 0 :(得分:1)
您可以为文件名传递空字符串
'Declare a script with your variable
Dim script1 As String = "<script>var popwin = window.open('','myPopup');popwin.document.write('" & str1 & "');</script>"
'Call your script with ScriptManager for async postback from UpdatePanel
ScriptManager.RegisterStartupScript(Me, Me.GetType(), "poptest", script1, true)
'Call your script with ClientScript for synchronous postback outside/without UpdatePanel
ClientScript.RegisterStartupScript(Me.GetType, "popuptest", script1, True)
检查此Call javascript function from asp.net code behind after server side code executes