Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

alert won't display

Status
Not open for further replies.

slatet

Programmer
Sep 11, 2003
116
US
We are using an alert inside of a .net app that is written in VB. I'm not sure if the problem is Javascript or VB related so I am posting to both forums.

All the previous code to this line works perfectly, but when you get to this line it sometimes works. Its one long line.

Response.Write("<HTML><script type=""text/vbscript"" language=""vbscript"" src=""SCRIPTS/OutlookExport.vbs""></script><body><SCRIPT FOR=window EVENT=onload LANGUAGE='JScript'>alert(" & Chr(34) & JScriptEncodeSpecialChars(sResponseMessage) & Chr(34) & ");" & sOutlookExportCode & ";try {parent.opener.parent.menuframe.makeChange(1); if(parent.opener.parent && parent.opener.parent.hiddenframe) {parent.opener.parent.mainframe.location.reload(false);}else {parent.opener.parent.location.reload(false);}}catch(Exception) {}window.parent.close();</script></body></HTML>")




This is the function that is called in the above line.



Function JScriptEncodeSpecialChars(ByVal strTemp As String) As String
On Error Resume Next
strTemp = Replace(strTemp, """", "'")
JScriptEncodeSpecialChars = strTemp
End Function




I'm not sure if I should post all of the code for OutlookExport.vbs so I won't for now. Basicially the functions in this file insert or update items in the outlook tasks list. We currently do not use outlook or outlook express so it is not configured on every machine, could this be why?

We realize this isn't much to go on, we are stuck too. Any suggestions are appreciated.
 
Instead of replacing your double quotes with single quotes (which will error if your string has a single quote in it), try replacing them with escaped double quotes.
Code:
Function JScriptEncodeSpecialChars(ByVal strTemp As String) As String
        On Error Resume Next
        strTemp = Replace(strTemp, """", "\""")
        JScriptEncodeSpecialChars = strTemp
End Function

Adam

recursion (n.) See recursion.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top