Jump to content

[SOLVED] how to make a popup


Lodius2000

Recommended Posts

hi there all, I am trying to make a good ol popup, that is multibrowser, especially firefox compatible, ie target blank doesnt work becuase it forces it into a tab, plus i want this new window to be smaller than a full maximized browser window because it is basically a widget on my page that you dont need once it has done its duty, so i have a close window button that works

 

i tried this

page 1 linked to the widget page via target="_blank" and the wiget page contained the follow js in the <head>

<script>
window.resizeTo(500, 500);
</script>

that opened a new tab and then resized all the tabs to 500 by 500

 

so i found this code on the intartubes that i put into a print statement on page 1 from above, but i dont know anything about js

<?php
print '<a href="../imageupload/index.php" onclick="window.open(\'../imageupload/index.php','popup','width=500,height=500,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0\'); return false\'>Upload photo</a>';
?>

php gives me a parse error saying im missing a comma (,) somewhere in this line, i dunno where to start, or even if this will work. I do like the non resizable, non scroll, non toolbar approach

 

I just want it to be a new window with no tools or bars 500 by 500 that displays my php

 

thanks

Link to comment
Share on other sites

well it look slike your somehow ending your string halfway through:

 

'<a href="../imageupload/index.php" onclick="window.open(\'

 

I dont use print, however that will be interpreted as onestring will it not.  therefore your missing comma should bethe character after that.

 

gdlk

Link to comment
Share on other sites

pc nerd

 

the \ is an escape character so that ' means literally ' not "end string here"

notice that the entire string is the same color in the code, meaning it is all 1 string, that is as long as this code interpreter is correct

Link to comment
Share on other sites

pc nerd

 

the \ is an escape character so that ' means literally ' not "end string here"

notice that the entire string is the same color in the code, meaning it is all 1 string, that is as long as this code interpreter is correct

 

Actually you have only one un-escape delimiter on the string and you have the series of ' (single quotes) if you look at the color coding the comma's in the string are green

 

<?php
print '<a href="../imageupload/index.php" onclick="window.open(\'../imageupload/index.php\',\'popup\',\'width=500,height=500,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0\'); return false;\">Upload photo</a>';
?>

Try that :)

Link to comment
Share on other sites

Darkwater

 

cant believe i didnt see that thanks,

 

//note, I added a target="_blank" in there because the link was opening in the same window

 

but

 

the redone code still just opens a new tab in firefox, no resize

 

in safari it opens a new window but there is no resize either

 

code now looks like

 

<?php
print '<a href="../imageupload/index.php" target="_blank" onclick="window.open(\'../imageupload/index.php\',\'popup\',\'width=500,height=500,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0\'); return false;\">Upload photo</a>';
?>

Link to comment
Share on other sites

<?php
print '<a href="javascript:void();" onclick="window.open(\'../imageupload/index.php\',\'popup\',\'width=500,height=500,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0\');\">Upload photo</a>';
?>

 

Okay try that, the first post I was just trying to help you fix your code.

 

I think the way you have it will try to open up the URL cause you have it in a HREF you might want to try echoing a function for it to use (JScript)

 

But try that first.

Link to comment
Share on other sites

this is the exact code I have running on my site (converted to PHP output and to accommodate your usage)

 

<?php
echo("<script type=\"text/javascript\">\nfunction uploadwindow() {
new_window = window.open('../imageupload/index.php','popup','width=500,height=500,scrollbars=no,resizable=no,toolbar=no,directories=no,location=no,menubar=no,status=no,left=0,top=0');
}
</script>
<a href=\"javascript:uploadwindow();\">Upload Photo</a>");
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.