Click to See Complete Forum and Search --> : Open New Browser using javascript in SQL stmnt


HoiPolloi
02-15-2008, 02:22 PM
Is it possible to insert something like this:

<A HREF="javascript:void(0)"
onclick="window.open('URL',
'welcome','width=410,height=320')">
Open a new window</A>

into a sql statement like this:

if sLit_7cType = "html" then
objRegExp.Pattern = """\b"
sLit_7cFNAME = objRegExp.Replace(sLit_7cFNAME, "<em>")
objRegExp.Pattern = "\b"""
sLit_7cFNAME = objRegExp.Replace(sLit_7cFNAME, "</em>")
video = video & " <a href='/literature/" & sLit_7c & "." & sLit_7cType & " 'target=_blank'>" & sLit_7cFNAME & "</a><br />" & vbCr
end if

I'm trying to open up video that is being pulled from my database in a new browser with a determined window size but don't know if it's possible. I've read that javascript can not communicate with databases. Is there a way to do it with asp? Help!

felgall
02-15-2008, 02:52 PM
if sLit_7cType = "html" then
objRegExp.Pattern = """\b"
sLit_7cFNAME = objRegExp.Replace(sLit_7cFNAME, "<em>")
objRegExp.Pattern = "\b"""
sLit_7cFNAME = objRegExp.Replace(sLit_7cFNAME, "</em>")
video = video & " <a href='/literature/" & sLit_7c & "." & sLit_7cType &
" 'target=_blank' onclick=\"window.open('URL','welcome','width=410,height=320');return false;\">" & sLit_7cFNAME & "</a><br />" & vbCr
end if

HoiPolloi
02-15-2008, 02:57 PM
Thanks for your prompt reply. I entered the code but got the following syntax error:

Microsoft VBScript compilation error '800a03ea'

Syntax error

/test/dbConnect.asp, line 200

video = video & " <a href='/literature/" & sLit_7c & "." & sLit_7cType &
------------------------------------------------------------------------^


Eddie

yamaharuss
02-16-2008, 08:10 AM
There are several things wrong.

You need to double your quotes in ASP. You've also got your single quote closing the href next the target (href='literature/blah'target=blah) - see the missing space?

You have semicolon and colon together. (false;\:)

There's also no reason to use your \ qualifiers as this is not Javascript.

video = video & " <a href='/literature/" & sLit_7c & "." & sLit_7cType &
" 'target=_blank' onclick=\"window.open('URL','welcome','width=410,height=320');return false;\">" & sLit_7cFNAME & "</a><br />" & vbCr


change that to

video = video & " <a href=""/literature/" & sLit_7c & "." & sLit_7cType &
""" target=""_blank"" onclick=""window.open('URL','welcome','width=410,height=320'); return false;"">" & sLit_7cFNAME & "</a><br />" & vbCr



Always use response.write to test your code along the way.

Response.write ("video = " & video)