Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Jul 2005
    Location
    mx.city
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    show a user how many times s/he has clicked a hyperlink

    I'm looking for a way to show a user how many times (modulo 4) s/he has clicked on a certain hyperlink. Like this:

    http://textzi.net/test

    I would like to get rid of the frames set up and just change the the [n] that's on the left frame.

    The only way I can think of doing this is using document.write and rewrite everything. Like this:

    http://textzi.net/test2

    Is there a simpler way of doing this, without having to rewrite everything? I just want to change the [n]....

  • #2
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    You can update the content of

    <span id="myid"></span>

    using

    document.getElementById('myid').innerHTML = 'new content';
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #3
    New to the CF scene
    Join Date
    Jul 2005
    Location
    mx.city
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks for this felgall!
    it works wonders.

    i have to ask, because i can't find 'getElementById' in my javascript book... where does it come from?

  • #4
    Regular Coder
    Join Date
    May 2005
    Posts
    100
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Here's a tutorial on it if that's what you wanted.

    Click

  • #5
    New to the CF scene
    Join Date
    Jul 2005
    Location
    mx.city
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks, CrAzY_J.


  •  

    Posting Permissions

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