我想在后面的代码中获取此脚本值吗?
Dim js As [String] =
(vbCr & vbLf & " if(confirm('Do you want to delete?')==true)" & vbCr & vbLf & "
document.getElementById('" & txtRespuesta.ClientID & "').value='true';"
& vbCr & vbLf & " else" & vbCr & vbLf & "
document.getElementById('") + txtRespuesta.ClientID & "').value='false';" & vbCr & vbLf & " "
ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "Key", js, True)
If txtRespuesta.Text = "true" Then
'Action 1
Else
'Action 2
End If
如何捕获此脚本值?
如果我点击YES = true,No = false ..
答案 0 :(得分:1)
onClick="if(confirm('do you really want to delete this?'))
{
delete()
}
else
{
//donothing or whatever
}
另外,错过了“不应该在客户端脚本中工作”的部分。我真的不知道你的意思,但是javascript是一种客户端脚本语言,你需要使用某种HttpRequest来与服务器通信。