Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Results 1 to 3 of 3
  1. #1
    Join Date
    Dec 2004
    Location
    Essex, UK
    Posts
    3,285
    Tokens
    0

    Latest Awards:

    Default Javascript Text Replacer

    This is useful if you wanna make your page move quickly and easily It uses Javascript to replace an id (eg. <span id="this">Replaces this</span>). It works instantly and is very easy to use in different situations.

    Getting it on your page

    You need to put some code in your head tag to put it in your page - there are two options, easy and valid, the easy option is to put the following into the head tag:

    Code:
    <script type="text/javascript">
    function idReplacer(id, what)
    {
    	getter = document.getElementById(id);
     	getter.innerHTML = what;
    }
    </script>
    If you want to follow standards paste the following into a blank file called replace.js:

    Code:
    function idReplacer(id, what)
    {
    	getter = document.getElementById(id);
     	getter.innerHTML = what;
    }
    and then place the following in the head of where you want to use it:

    Code:
    <script type="text/javascript" src="replace.js" />
    How to Use It

    The beauty of using Javascript is that it is very easy to run. The easiest ways to start off with, are simply using a normal "A" tag like you use for links, but using "onClick" or "onMouseOver" instead of "href".

    Create the span you want to replace, for example one called "here". To do that put the following - you could make it empty to start or you could just change the text:

    Code:
    <span id="here">Hello!</span>
    and then to create a link to do the work do this:

    Code:
    <a href="#" onClick="idReplacer('here', 'REPLACING DONE');">REPLACE TEXT</a>
    That link is activated when you click "REPLACE TEXT". What happens is the onClick function waits for a click, when it happens it activated the earlier Javascript function, idReplacer with the ID to replace as "here" (you made it earlier) and the text to replace it with as "REPLACING DONE".

    Hopefully reading this has told you how to use it and how it works. If you want to make the thing happen when someone puts there mouse on the link, change onClick to onMouseOver.

    Thanks,

    Tim



    i used to be NintendoNews. visit my blog or add me on twitter.
    need help with vista? i am a microsoft certified technology specialist in configuring windows vista and connected home integrator.. pm me for help!


    "I am the way, the truth, and the life. No one comes to the Father except through me"
    John 14:6 (NIV)


  2. #2
    Join Date
    Jan 2006
    Location
    Cambridge
    Posts
    1,911
    Tokens
    0

    Latest Awards:

    Default

    I Had an idea which u cud make to proove ur da 'G' Of habbox

    a userbar maker, ive seen em on the internet lol
    EDTALKING


  3. #3
    Join Date
    Aug 2004
    Location
    bristol
    Posts
    3,799
    Tokens
    0

    Latest Awards:

    Default

    Would be easier to just have:
    HTML Code:
    <a onclick="document.getElementById('bob').innerHTML='hi'">Hello</a>

Posting Permissions

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