SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Popup similar at sitepoint

    Hello
    i find a javascript similar that used on this forum

    When i do a click on link first time i open a popup after i click i go on click link

    It's difficult find this script ?

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    View the source of the script here and figure out how it works. JavaScript is "open source" by necessity... you can always read any site's JavaScript.

  3. #3
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank for reply. I have try to read the javascript but i am not able to obtain the necessary code

    What kind of javascript can i find on google ??

  4. #4
    SitePoint Member Mupo's Avatar
    Join Date
    Oct 2007
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    write this code to save labour This is not difficult make this code.

  5. #5
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i am not able to do this code.
    Have you the javascript ?

  6. #6
    SitePoint Member Mupo's Avatar
    Join Date
    Oct 2007
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This is very usual example, i test this script with FF.
    Code HTML4Strict:
    <html>
    <head>
        <title>test</title>
    </head>
    <script>
    var win;
     
    function oSimple()
    {
        this.status = new Array();
        this.index = 0;
    }
     
    oSimple.prototype.Act = function(_index, _href)
    {
        switch( this.status[_index] )
        {
            case 0:
                win = window.open(_href, "zxzx", "top=100, left=100, width=200, height=400", false);
                this.status[_index]++;
                return false;
            break;
            case 1:
                if ( typeof win == "object" )
                {
                    win.close();
                }
                window.location = _href;
                return;
            break;
        }
        return;
    }
     
    oSimple.prototype.assignObject = function(_point)
    {
        this.index++;
        this.status[this.index] = _point;
        return this.index;
    }
    </script>
    <body>
    <a href="http://google.com" >google</a><br/>
    <a href="http://yahoo.com" >yahoo</a><br/>
    <script>
        var oLink = new oSimple();
        var obj = document.getElementsByTagName("a");
        for ( var i = 0; i < obj.length; i++ )
        {
            obj.item(i).setAttribute("onclick", "oLink.Act("+(oLink.assignObject(0))+", this.href); return false;");
        }
    </script>
    </body>
    </html>

  7. #7
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for the script.
    But if i want open in popup for example the url www.msn.com and not yahoo or google is it possibile ?

  8. #8
    SitePoint Member Mupo's Avatar
    Join Date
    Oct 2007
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, It is valid for all correct urls ( msn, hotmail, mail.ru, yandex.ru, cnn, bbc, localhost, ... ).

  9. #9
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    yes ok
    but i want that if i click on www.yahoo.com and my popunder is www.msn.com at the first click open msn and not yahoo and at second click open yahoo

    Is it possible ?

  10. #10
    SitePoint Member
    Join Date
    Aug 2007
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i havent' resolved with my problem
    can you help me again ?


Bookmarks

Posting Permissions

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