tom tom - 1 month ago 16
Javascript Question

Javascript window.open() with php code (true popup)

I am trying to have a window popup from a hyperlink.

I have my window with a hyperlink on which I want to open a popup with the OnClick event.

I am using PHP with javascipt.

OK first code with first symptoms.

echo '<a href="" onclick="javascript:void window.open(this.href, '\1436971878137\','\width=700,height=500,toolbar=0,menubar=0,location=0,status=0,scrollbars=0, resizable=0,left=0,top=0\');return false;">Edit</a>'


It doesn't open a popup, it just refreshes the hosting page, so not what I want.

Now other code, other symptoms:

echo '<a href="http://www.google.fr" onclick="javascript:void window.open(this.href,'\1436971878137\','\width=700,height=500,toolbar=0,menubar=0,location=0,status=0,scrollbars=0,resizable=0,left=0,top=0\');return false;">Edit</a>'


It changes my hosting page for google, so it is not a popup either.... So not what I am looking for.

What I am looking for: having a popup, but I tried many many things before asking here, without success. So I am hoping somebody could help me on this.
Actually google is here just for the example, in my real application it will be a PHP page with a formular on it....

[Edit : ] What I want is a small popup in the same window, like when you do a rightclick on desktop you have a small popup with menus, see? I don't want a popup that does open in a new tab, this is not what I want. I am looking for a small popup in the page I am in.
Many thanks for your replies !

tom tom
Answer

so far so good, here is the solution to have a real popup, not a new page and not a refresh of the hosting page. Here we go !

echo '<a href="javascript: void(0)" onclick="window.open(\'formulaire.php\',\'windowname1\', \'width=600, height=500\'); return false;">Edit</a>';
Comments