Crave: A modern WordPress theme with appetizing aesthetic


Results 1 to 5 of 5

Thread: POPUP WINDOW IN JAVA SCRIPT

  1. #1
    Join Date
    May 2010
    Location
    India
    Posts
    29

    Default POPUP WINDOW IN JAVA SCRIPT

    Guy's I am fresher in development field. I am developing a site now a days. I want to creat a POP UP window in my site but I have no idea How can I make it? So Please help me!!!

    Thanks:

    Alex_tom

  2. #2
    Join Date
    Jan 2009
    Location
    Sylvarant
    Posts
    173

    Default

    This is simple.

    In javascript:
    Code:
    function openPopup(url) {
        window.open(url);
        return false;
    }
    To keep your HTML clean (without any event attributes inside tags) you should give something an event using javascript, that way if you have to modify the JavaScript anytime it is easy and vise versa for HTML tags. An example for this using Anchor tags would be (in jQuery):

    Code:
    $(document).ready(function() {
       $("#anchors a").click(openPopup);
    });
    
    function openPopup() {
        window.open(this.src);
        return false;
    }
    Which would be used with this HTML:

    HTML Code:
    <div id="anchors">
        <a href="page2.html">Page 2</a>
    </div>
    Last edited by sikuneh; 05-31-2010 at 06:34 PM.

  3. #3
    Join Date
    Dec 2012
    Posts
    3

    Default

    Looking around. Finnally find this old thread which is similar to my question. But that is not my answer,

  4. #4
    Join Date
    Dec 2012
    Location
    Germany
    Posts
    17

    Default

    The first thing I do whenever I have a problem like this is looking for a website which has the feature I desire (most times, I have one in my bookmarks).

    Then I have a look at that site's code (by right-clicking on an empty part of the site and choosing 'View Page Source') to see how they have gone about it.
    I've found this method to be quite helpful so far ... and in addition, it has taught me a lot of things I hadn't even been looking for, at the given time.

    Cheers,
    G.
    Last edited by Gaius; 12-07-2012 at 11:49 AM. Reason: typo correction

  5. #5
    Join Date
    Dec 2012
    Posts
    12

    Default

    There are two kinds of pop ups.

    The first kind creates another window in the browser. There were pop over and pop under windows. They got to be so annoying that the browsers evolved to block this kind of pop ups.

    The second generates the popup within the existing window in the browser. Sometimes these windows slide in from the edge of the page.

    Do a search for "javascript onpage popup generator" for code examples.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •