Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

href + onClick problem.

Status
Not open for further replies.

billycat

MIS
Apr 28, 2005
22
US
Trying to have a link go to an external window named "somename" then close itself..
Code:
echo "<a style=\"text-decoration:none; color: navy; \" href=\"search_results55.php" onClick=\"javascript:self.close();\"  target=\"somename\">"; }
 
Two things:

First, remove the "javascript:" in the onclick. If that doesn't work, go the the next step.

Second,
I would just create a javascript function that did it.

PHP ?
Code:
echo "<a style=\"text-decoration:none; color: navy; \" href=\"javascript:OpenClose('search_results55.php');\">";

Javascript
Code:
function OpenClose(url)
{
   window.open(url, "someone", "width=400, height=400");
   window.close();
}

It will prompt the user if they want to close the browser though. Security mechanism. (Unless it was opened by another browser window, in which case why are you opening so many windows ;-) )

Ron Wheeler
Tekdev Open Source Development
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top