PDA

Click to See Complete Forum and Search --> : Javascript again - hopefully explained a bit better!!


turfbult
Jan 30th, 2001, 08:51 AM
Hello,

I think my previous thread concerning this was a bit much to understand!! I'll try again.

How can I pass a variable to this function..

<script language="JavaScript">
<!--
function windowOpen1()
{ window.open("CityInterest.html","NewWindow","width=600,height=400,noresize,scrollbars=yes,toolbar=0,menubar=0");
}
// end popup windows -->
</script>



This is how I currently call this function......

target = "_blank"
link = "Javascript:windowOpen1()"

<a href="<%=link%>" target="<%=target%>">


What will happen now is that cityinterest.html will open in a new window with the specified
width, height etc etc.

My question now is....
How can I change my variable "link", and my script to open up ANY page I specify within "link"??
Eg. I am now bound to opening up cityinterest.html. Lets say I want to open testpage.htm - I
would want to do something like

target = "_blank"
link = "Javascript:windowOpen1(),'testpage.htm'"
<a href="<%=link%>" target="<%=target%>">

I tried this an it does not work. In any case "cityinterest.html" is still hardcoded in my script!!

EG. I want to be able to change my variable "link" as I wish and so be able to open any page
via the script.

Thanks,
T

sebs
Jan 30th, 2001, 09:08 AM
what your asking is not hard!!

your asp produce(dynamically) html,right and javascript too!

so when your page is beiing generated assign the value
you want to your link!

you can put it in a loop or for....next

For x = 0 to 10
%>
<a href="<%="link" & x %>" target="<%="target" & x%>">
<%
next


something like that anyway!!!