Solved

open a link in pop up onclick

Posted on 2008-10-24
4
495 Views
Last Modified: 2012-05-05
i would like to open a link in pop up onclick with the  onclick event
0
Comment
Question by:evry2004
  • 2
  • 2
4 Comments
 
LVL 9

Expert Comment

by:Shahzad Fateh Ali
ID: 22799176
Hi,

For only external link you can use target='_blank'.

But for a forced popup use the attached function.

// external link

<a href='http://www.google.com/' target='_blank'>Google</a>
 

//forced popup
 

function popup(url,w,h)

{

window.open(url,'','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,width='+w+',height='+h+',screenX=300,screenY=350,top=350,left=300');

}

Open in new window

0
 

Author Comment

by:evry2004
ID: 22804572
i want to associate the onClick event with the pop up window here is the scenario :
this is the external link i want to promote diasfm.com . whenever user click on the main page of my website the promotion link should pop up actually they are not clicking on the promotion link. it's like cliking on any part of the page will execute the pop up .
0
 
LVL 9

Accepted Solution

by:
Shahzad Fateh Ali earned 500 total points
ID: 22807712
Hi,

You can try something like this. what you need is to add your onClick event on that tag that is wrapping your complete body of the webpage.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>Popup Test</title>

<script type="text/javascript" language="javascript">
 

function popMarket(url){

	window.open(url);

}

</script>

</head>
 

<body>

<div onclick="popMarket('http://www.google.com')">

<table width="100%" border="0" cellspacing="0" cellpadding="0">

  <tr>

    <td height="100">Header</td>

  </tr>

  <tr>

    <td height="400">Body</td>

  </tr>

  <tr>

    <td height="100">footer</td>

  </tr>

</table>

</div>

</body>

</html>

Open in new window

0
 

Author Comment

by:evry2004
ID: 22807860
thanx great you went straight to the point
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Problem to open Excel file 15 99
What language/protocol is the Angular Chat? 2 58
replace a word with other 1 40
How to convert String matching to regex in java 4 21
If you haven’t already, I encourage you to read the first article (http://www.experts-exchange.com/articles/18680/An-Introduction-to-R-Programming-and-R-Studio.html) in my series to gain a basic foundation of R and R Studio.  You will also find the …
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now