Solved

popup webpage

Posted on 2012-03-25
2
426 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to dynamically set the form action using jQuery.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

825 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