1
xsell
pop up link
  • 2009/2/16 20:51

  • xsell

  • Quite a regular

  • Posts: 245

  • Since: 2008/9/2 1


Hello

How can i edit this link below to open the file upload.php as popup window when someone clicks it.it is php code

echo "<a href='upload.php' style='text-decoration:none'>$upload</a> <a href='upload.php'><img src='flags/$upload_code.png' border ='no'></a>n";

2
zyspec
Re: pop up link
  • 2009/2/16 23:28

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


The easiest way is:
echo "<a href='upload.php' style='text-decoration:none' target='_blank'>$upload</a> <a href='upload.php'  target='_blank'><img src='flags/$upload_code.png' border ='no'></a>n";
some will argue that target='_blank' isn't XHTML compliant and that you should use:
echo "<a href='upload.php' style='text-decoration:none' rel='external'>$upload</a> <a href='upload.php'  rel='external'><img src='flags/$upload_code.png' border ='no'></a>n";
although I have seen more issues using rel='external' than with target='_blank'.

3
xsell
Re: pop up link
  • 2009/2/17 1:11

  • xsell

  • Quite a regular

  • Posts: 245

  • Since: 2008/9/2 1


Thx but this open in new page , i would it to open as pop up window , a small window Ex .width 300 hight 200.

4
zyspec
Re: pop up link
  • 2009/2/17 3:31

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


Oh, now I understand. You can do this with javascript. Just search the internet for "javascript open.window example" and you'll find several examples of ways to do what you want.

Basically you'll create a javascript function that opens the window and you'll call this function from your link.

5
tcnet
Re: pop up link
  • 2009/2/17 13:02

  • tcnet

  • Friend of XOOPS

  • Posts: 297

  • Since: 2006/5/12


The javascript required to open a new popup window is already in xoops.js (line 49):

function openWithSelfMain(url,name, width, height, returnwindow) 
{
    var 
options = "width=" + width + ",height=" + height + ",toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no";
    var 
new_window = window.open(url, name, options);
    
window.self.name = "main";
    
new_window.focus();
    return (
returnwindow != null ? new_window : void(0));    
}

Call it with:
<a href="javascript:openWithSelfMain('http://yoursite.com/yourfile.html','YourWindowName',300,200);">Your Popup Link</a>

See the FAQ: How do I make a link open a popup in my page? by Carnuke