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

html file name as variable 1

Status
Not open for further replies.

qfkeon

Programmer
May 29, 2001
58
US
I want to generate a popup window that contains one of several pages. Within the link to each page I want to pass the file name to the script. I am trying to do this by modifying some free code that I found online. Here is what I have.

<script>

//Popup Window Script
//By JavaScript Kit (//JavaScript tutorials and over 400+ free scripts

function openpopup(){

var popurl=&quot;filename.html&quot;
winpops=window.open(popurl,&quot;&quot;,&quot;width=400,height=338,resizable,&quot;)
}

</script>

<a href=&quot;javascript:eek:penpopup()&quot;>Click here to open window</a>

I want to specify

function openpopup(pagesource)
var popurl=pagesource

or just pass pagesource directly into

winpops=window.open(pagesource,&quot;&quot;,&quot;width=400,height=338,resizable,&quot;)


I have tried referencing the pagesource with &quot;'+ +'&quot; &quot;&quot; '' as well as other combinations and I am unable to make this work. My script resides in the <HEAD> portion of the page and I am referencing my link with <a href=&quot;javascript:eek:penpopup(pagesource.html)&quot;>Link</a>

Any suggestions would be GREATLY appreciated. Thank you.
 
did you try the following??:
<a href=&quot;javascript:eek:penpopup('pagesource.html')&quot;>link</a>
???
hope it helps Suceess, thats the way you spell success!
Got a question? Ask IMOZRMY!
 
actually, the problem you might be having is passing the period &quot;.&quot; ... try this:

winpops=window.open(pagesource+'.html',&quot;&quot;,&quot;width=400,height=338,resizable,&quot;)

<a href=&quot;javascript:eek:penpopup('pagesource')&quot;>link</a> Suceess, thats the way you spell success!
Got a question? Ask IMOZRMY!
 
Thank you IMOZRMY. I tried the first suggestion and it worked.
 
no problem :) Suceess, thats the way you spell success!
Got a question? Ask IMOZRMY!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top