Solved

popup webpage

Posted on 2012-03-25
2
424 Views
Last Modified: 2012-03-25
hello - im new to popups and im trying to get this pop up method to work.

what im trying to accomplish is this:

1. have parent page with href link to popup
2. when popup opens it goes to middle of screen
3. when you click on a link in the popup it will take you to the selected page from the parent window of the popup.

i.e. when you click on popup form opens page in center of screen then shows you a list of other href links to choose from. so when you choose the link in the popup window the popup window should close and goto the requested page in the original window.

here the code that i have so far:

javascript popup
<script type="text/javascript">
<!--
function popup(url) 
{
 params  = 'width='+screen.width;
 params += ', height='+screen.height;
 params += ', top=0, left=0'
 params += ', fullscreen=yes';

 newwin=window.open(url,'windowname4', params);
 if (window.focus) {newwin.focus()}
 return false;
}
// -->
</script>

Open in new window


the href onclick
<p align="center"><a href="lang/de/index.php" title="German"  onclick="popup('popup.html')" />Deutsch</a>

Open in new window




thanks in advance for your help!
0
Comment
Question by:only1wizard
2 Comments
 
LVL 7

Accepted Solution

by:
Lalit Chandra earned 500 total points
ID: 37762969
Ok, you can achieve this more easily as of Jquery made this simple for you.

1.  Just add the jquery and Jquery UI js reference to your page head section.
   <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
  <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
       
2. Create a link, which will be responsible to show the popup.
   <a id="ShowPopUp" href ="#"> Show Links </a>

3.  Create the Div with the following markup
    <div id="divPopUp" style="display:none;">
        <a href="xyz.html">Link 1</a>
        <a href="xyz.html">Link 2</a>
        <a href="xyz.html">Link 3</a>
     </div>  
 
4. Now write the code something like below
   $(function() {
           $("#ShowPopUp").click(function() {
                   $("#divPopUp").dialog({width:600,height:500,modal: true});
          });
         $("#divPopUp a").click(function() {
                     window.location.href =$(this).attr("href");  
         });
});

Hope this will solve your problem.
0
 

Author Closing Comment

by:only1wizard
ID: 37763029
thanks for your help i have some tunning to do to it but it works the way i want it to.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
Read about why website design really matters in today's demanding market.
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

762 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

19 Experts available now in Live!

Get 1:1 Help Now