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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HREF and VBScript function (Help Please)

Status
Not open for further replies.

jon2002

Technical User
Jun 26, 2002
13
GB
I have the following lines in my code but the function is not being called I am getting page cannont be displayed.

Any Help would be most appreciated.

tempurl = "vbscript:FileOpener(" & chr(34) & objRS("document_reference") & chr(34) & ");"

<a href='<% =tempurl%>' target=&quot;_blank&quot; ><%=objRS(&quot;title&quot;) %></a><br>

Thanks all

Jon
 
Hi ...
however it's better to use javascript for this but you can try this code :

<a href=&quot;#&quot; onclick=&quot;vbscript:ddd('dfdfdfdf')&quot;>sss</a>

<a href=&quot;#&quot; onclick=&quot;vbscript:FileOpener('<%=objRS(&quot;document_reference&quot;)%>')&quot; target=&quot;_blank&quot; ><%=objRS(&quot;title&quot;) %></a><br>
----
TNX.
E.T.
 
Thanks ehsant

that seem to be trying to call the function now but I am getting a Type Mismatch on the following line if I view the source :-

<a href=&quot;#&quot; onclick=&quot;vbscript:FileOpener('_148297523_Writing a Stored Procedure.txt')&quot; target=&quot;_blank&quot; >test</a><br>

I really dont understand why

Thank you
Jon
 
Hi ...
this code is OK ...
but on the FileOpener function, you have to get a input variable which you are passing '_148297523_Writing a Stored Procedure.txt' to it.
is it string ?
if you still have problem, can you send the script here too ?
----
TNX.
E.T.
 
Thanks for the help Ehsant

I think I have done it now by using the following I have changed the function to just be a seperate asp file and am calling that from another page:-

<a href='fileopen.asp?doc=<% =objRS( &quot;document_reference&quot;)%>' target=&quot;_blank&quot; ><%=objRS(&quot;title&quot;) %></a><br>


FileOpen.asp
<SCRIPT Language=VBScript RUNAT=Server>
docref = Request.QueryString(&quot;doc&quot;)
Response.buffer = TRUE
Ext = right(docref, 3)

Select Case Ext
Case &quot;doc&quot;
Response.ContentType = &quot;application/msword&quot;
Case &quot;xls&quot;
Response.ContentType = &quot;application/x-msexcel&quot;
Case &quot;txt&quot;
Response.ContentType = &quot;application/msword&quot;
Case &quot;gif&quot;
Response.ContentType = &quot;image/gif&quot;
End Select

Dim vntStream
Dim fulldocname

Set oMyObject = Server.CreateObject(&quot;MyObject.BinRead&quot;)
fulldocname = &quot;C:\document_references\&quot; & docref
vntStream = oMyObject.readBinFile( fulldocname )

Response.BinaryWrite(vntStream)

Set oMyObject = Nothing

Response.End
</script>

Kind Regards
Jon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top