SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Thread: repetitive Link

  1. #1
    SitePoint Wizard Blake Tallos's Avatar
    Join Date
    Jun 2008
    Location
    Cuyahoga Falls, Ohio.
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    repetitive Link

    http://isyournewbicycle.com/

    My friend came to me asking me what this is? I think this is pretty cool how this link can keep going and going and going. I looked at the source and i saw that its javascript. Can this same feature be done in css and Html? Without having to use javascript? If so i think it would be pretty neat.I want to use this method with images.
    Blake Tallos - Software Engineer for Sanctuary
    Software Studio, Inc. C# - Fanatic!
    http://www.sancsoft.com/


  2. #2
    Ripe Tomatos silver trophybronze trophy Rayzur's Avatar
    Join Date
    Jun 2007
    Location
    Texas
    Posts
    4,174
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Hi Blake,

    MEME definitely needs a bigger boat! How Funny

    As far as doing it with random page loads which appears to be the case, you won't get that through html.

    But it could be done until you are exhausted from linking one page to the next.

  3. #3
    SitePoint Wizard Blake Tallos's Avatar
    Join Date
    Jun 2008
    Location
    Cuyahoga Falls, Ohio.
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well then could you help me find a script that i can use to be able to put images in the code so i can have a image display?
    Blake Tallos - Software Engineer for Sanctuary
    Software Studio, Inc. C# - Fanatic!
    http://www.sancsoft.com/


  4. #4
    Ripe Tomatos silver trophybronze trophy Rayzur's Avatar
    Join Date
    Jun 2007
    Location
    Texas
    Posts
    4,174
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Sorry I'm not that good at js.
    I would think that someone in the js forum could point you in the right direction.

  5. #5
    SitePoint Wizard Blake Tallos's Avatar
    Join Date
    Jun 2008
    Location
    Cuyahoga Falls, Ohio.
    Posts
    1,508
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you Rayzur
    Blake Tallos - Software Engineer for Sanctuary
    Software Studio, Inc. C# - Fanatic!
    http://www.sancsoft.com/


  6. #6
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Moved to JS forum for a different audience.
    Jason Sweat ZCE - jsweat_php@yahoo.com
    Book: PHP Patterns
    Good Stuff: SimpleTest PHPUnit FireFox ADOdb YUI
    Detestable (adjective): software that isn't testable.

  7. #7
    Function Curry'er JimmyP's Avatar
    Join Date
    Aug 2007
    Location
    Brighton, UK
    Posts
    2,006
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The site you linked to does not use JS at all. It's probably just a simple PHP script which shows a random message...

    You can do this with JavaScript... Something like this maybe:

    Code JavaScript:
    var text = [];
     
    text[0] = 'RANDOM TEXT 1';
    text[1] = 'RANDOM TEXT 2';
    text[2] = 'RANDOM TEXT 3';
    text[3] = 'RANDOM TEXT 4';
    text[4] = 'RANDOM TEXT 5';
    text[5] = 'RANDOM TEXT 6';
    text[6] = 'RANDOM TEXT 7';
    text[7] = 'RANDOM TEXT 8';
     
    function random(limit){
        return Math.floor(Math.random() * --limit);
    }
     
    function changeRandomText(el,not) {
        var rand = random(text.length);
        if(rand===not) rand = (text[rand++]) ? rand++ : rand--;
        el.removeChild(el.childNodes[0]);
        el.appendChild(document.createTextNode(text[rand]));
        el.rel = 'e' + rand;
    }
     
    var link = document.getElementById('link');
    changeRandomText(link,0);
    link.rel = 'e0';
     
    link.onclick = function() {
        var not = parseInt(this.rel.substr(1),10);
        changeRandomText(this,not);
        return false;
    }

    HTML:

    Code html4strict:
    <a href="#" id="link">HELLO</a>
    James Padolsey
    末末末末末末末末末末末末末末末末末末末
    Awesome JavaScript Zoomer (demo here)
    'Ajaxy' - Ajax integration solution (demo here)


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
  •