Helpful Information
 
 
Category: JavaScript Development
php and javascript

How would i open a new browser window (like when you use the window.open in javascript) using php? The reason i ask is because i need to open a new window when the user clicks on an image, and then the full size image is displayed in the new window. A while ago i wrote a javascript function that took in the image filename and dimensions, and then created a new window and wrote the html to it with the <img src> and everything. Of course, i can't do this now because the variables i need to pass to the function are dynamically generated, and the javascript is already written to the client's html page.

If anyone knows any ways around this, thanks in advance!

Can you post the javascript or URL to a demo page? Myself or someone else may be able to help you then.

Take your existing javascript code & then:
(eg)
<?php echo "<script>document.write("alert("this can be any valid javascript code with $vars if you want")")</script>";?>



------------------
Simon Wheeler
FirePages -DHTML/PHP/MySQL

The function i had was:

Function ViewImage(imagetitle,filename)
{
var ImageView=window.open("", "newwin","height=150,width=200");
ImageView.document.write("<html>")
ImageView.document.write("<title>")
ImageView.document.write(imagetitle)
ImageView.document.write("</title>")
ImageView.document.write("<body>")
ImageView.document.write("<img src='https://forums.devshed.com/archive/index.php/")
ImageView.document.write(filename)
ImageView.document.write("'></body></html>")
}

This was replicated in each page. But the variables i need to pass to this function are generated from the php code.

Thanks for any help.










privacy (GDPR)