window.open

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

LTLhawk
New php-forum User
New php-forum User
Posts: 29
Joined: Fri Mar 07, 2003 4:17 pm

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 ?

User avatar
Joan Garnet
Moderator
Moderator
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars
Contact:

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'>";
?>

LTLhawk
New php-forum User
New php-forum User
Posts: 29
Joined: Fri Mar 07, 2003 4:17 pm

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)


Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 3 guests