Board index   FAQ   Search  
Register  Login
Board index php forum :: php coding PHP coding => General

window.open

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

window.open

Postby LTLhawk » Sun Jul 27, 2003 10:37 am

Hello,

I want to be able to open a page using a variable instead of a direct link. Example:

this will work:

<input name="down" type="button" onClick="window.open('C:/download/file.txt')" value="Click Me">

but what I want to do is make the "C:/download/file.txt" a php variable like <?php $location="C:/download/file.txt" ?>

and then;

onClick=("$location")

but I can not get this to work. Any ideas ?
LTLhawk
New php-forum User
New php-forum User
 
Posts: 29
Joined: Fri Mar 07, 2003 4:17 pm

Postby Joan Garnet » Sun Jul 27, 2003 12:59 pm

I don't know if you can open local files with javascript...
Anyway:
It should work:
Code: Select all
<?php
$location = "anything";
echo "<input name='down' type='button' onClick='window.open(\"". $location ."\")' value='Click Me'>";
?>
User avatar
Joan Garnet
Moderator
Moderator
 
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars

Postby LTLhawk » Sun Jul 27, 2003 1:35 pm

ah..of course..I didnt think of that..thanks (I tested it and it works great)
LTLhawk
New php-forum User
New php-forum User
 
Posts: 29
Joined: Fri Mar 07, 2003 4:17 pm


Return to PHP coding => General

Who is online

Users browsing this forum: Google [Bot] and 4 guests

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.

cron