Dynamic link

D

dwdino

I am trying to build a dynamic link. I have a variable with the file and path names (bubba.txt & folder1/folder2). I combine these in a script using var1 = cstr(path1 & "/" & file1)

Now, I want to place this in my page so users can use the hyper link. I have tried the following

<
document.write("<a href="http://mysite/" & var1 & ">" & file1 & "</a>"
%

But I get "Object Needed" error.
 
K

Kevin Spencer

You've got your server-side and client-side scripting all mixed up.
JavaScript (document.write) is client-side scripting, while you're using
server-side scripting tags (<%...%>) to delimit your script, and VBScript
"&" string concatenation syntax. As I have no idea which type of script you
are trying to write, I can't go any further with it.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

dwdino said:
I am trying to build a dynamic link. I have a variable with the file and
path names (bubba.txt & folder1/folder2). I combine these in a script using
var1 = cstr(path1 & "/" & file1).
 
G

George Hester

document.write is NOT an ASP object. You want Response.Write. If you want document.write then that is a VBScript command and you want:

<script type="text/vbscript">
document.write("")
</script>

var is also a javascript variable declare. So you have your scripting all jumbled up. Keep the languages seperate. ASP goes in ASP delimiters <%%>. Client script goes in <script> tags and use the correct statements for the scripting you are trying to use.

The concatenation character in javascript is "+" w/o the quotes.
 
Top