Я пытаюсь вызвать подтверждение всплывающего окна из asp classic. Есть ли способ получить этот код Javascript для выполнения? В настоящее время он не вызывается/не выполняется. Мне нужно всплывающее окно, чтобы пользователь мог подтвердить, хотят ли они удалить назначение или нет. Благодаря!Подтверждение Javascript от ASP Classic/VBScript
<%@ Language=VBScript %>
<!--#include file="content/securityheader.asp"-->
<!--#include file="connection.inc"-->
<!--#include file="connectionxref.inc"-->
<!--#include file="securityheader.asp"-->
<!--#include file="connectionSQL.inc"-->
<% 'SQL SECURITY CODE
function dbencodeStr(str)
thestr = trim(replace(str,"'","'"))
thestr = trim(replace(thestr,"""","""))
thestr = trim(replace(thestr,"<","<"))
thestr = trim(replace(thestr,">",">"))
thestr = trim(replace(thestr,vbCRLF,"<BR>"))
dbencodeStr = thestr
end function
%>
<script language = "javascript" runat="server">
function clearAssignment(assignmentID,relno,docrecid)
{
if (confirm("This is the last assignment for this relationship.")){
window.location.assign("procclearassignmentprompt.asp?assignmentID="+assignmentID+"&relno="+relno+"&docrecid="+docrecid);
}
}
</script>
<%
Server.ScriptTimeout=3600
'------------------------------
Function getName(str)
index = instr(str," ")
if index > 0 then
str = trim(mid(str,1,index))
end if
getName = str
End Function
'------------------------------
on error resume next
assignmentID = dbencodeStr(request.Querystring("assignmentID"))
docid = dbencodeStr(request.Querystring("docrecid"))
relno = dbencodeStr(request.Querystring("relno"))
thedate = now()
count = 1
'Check if this is the last assignment for relationship
strSQL = "select count(distinct reldocassignments.id) from reldocnotes inner join reldocassignments on reldocnotes.docid=reldocassignments.docid where relno = '"&relno&"' and reldocassignments.activeflag=1"
Set rs = objConnection.Execute(strSQL, ,adCmdText)
arr = rs.GetRows()
rows = UBound(arr,2)
for i = 0 to rows
count = trim(arr(0,i))
next
if count = 1 then
Response.Write "Calling =" & clearAssignment(assignmentID,relno,docrecid) & "."
else
if docid <> "" Then
''''Close any open assignments for the document
strSQL = "update RelDocAssignments set activeflag = 0, closedOn = getdate() where docid = '"&docid&"' and ID = '"&assignmentID&"';"
Set rs = objConnection.Execute(strSQL, ,adCmdText)
end if
Response.write(strSQL)
''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''
objConnection.close
set objConnection = nothing
objConnection2.close
set objConnection2 = nothing
objConnection3.close
set objConnection3 = nothing
Response.Redirect "relDetails.asp?relNo=" & relno
end if
%>
Count = <%=count%>
Серверный код выполняется в полном объеме, прежде чем выход передается ваших посетителей браузеров: это не запускать в интерактивном режиме вообще, поэтому это ничего не значит «вызывать» клиентскую функцию из кода на стороне сервера. По сути, все ваши файлы '.asp' - это генерировать текст клиенту. – Dai
Он фактически вызывает серверную функцию из кода на стороне сервера. Здесь ничего не происходит на клиенте. Но да, я думаю, что есть некоторая путаница в отношении того, как работает серверная сторона на стороне клиента. – Bond