?
Solved

popup webpage

Posted on 2012-03-25
2
Medium Priority
?
435 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 7

Accepted Solution

by:
Lalit Chandra earned 2000 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

777 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