Closed Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: Text when clicked a link

  1. #1
    barto90 is offline Newbie
    Join Date
    Feb 2010
    Posts
    7
    Rep Power
    0

    Text when clicked a link

    Hello all,

    I'm a trainee at a large enterprise in the Netherlands and i've got a project to develop a program for the company (webbased)

    Now i need a function that when i click a link certain information is displayed underneath the link.

    i used to know how to do this but now i need the code i've forgot how to do it, i thaught it was something with: "document.activate" or something like that.

    hopefully someboddy knows it.

    Regards,
    Bart

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Join Date
    Jul 2006
    Posts
    16,491
    Blog Entries
    75
    Rep Power
    143

    Re: Text when clicked a link

    jQuery provides a lot of functionality for that. You'll probably use CSS for most of this, though.
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  4. #3
    Sphexa is offline Newbie
    Join Date
    Mar 2010
    Posts
    21
    Rep Power
    0

    Re: Text when clicked a link

    I think your better off googleing a ajax or jquery script for this.

  5. #4
    brokenbylaw's Avatar
    brokenbylaw is offline Learning Programmer
    Join Date
    Dec 2009
    Posts
    62
    Rep Power
    0

    Re: Text when clicked a link

    hard to eat my burger and type but... it depends jquery does this in a couple of lines (with fades and different AWESOME effects lawl)

    or you can use javascript that turns the divs display on and off (idk the browser support though, you gotta ask firefox i think he's the one who was stubborn) but jquery go for that!

    http://api.jquery.com/category/effects/

  6. #5
    ChrisBie is offline Newbie
    Join Date
    Mar 2010
    Posts
    4
    Rep Power
    0

    Re: Text when clicked a link

    I was doing something like this:
    Code:
    <script type="text/javascript">
        function showStuff(id) {
            document.getElementById(id).style.display = \'block\';
        }
        function hideStuff(id) {
            document.getElementById(id).style.display = \'none\';
        }
    </script>

  7. #6
    barto90 is offline Newbie
    Join Date
    Feb 2010
    Posts
    7
    Rep Power
    0

    Re: Text when clicked a link

    Quote Originally Posted by ChrisBie View Post
    I was doing something like this:
    Code:
    <script type="text/javascript">
        function showStuff(id) {
            document.getElementById(id).style.display = \'block\';
        }
        function hideStuff(id) {
            document.getElementById(id).style.display = \'none\';
        }
    </script>
    Can you tell me how to use this when clicked a link?
    Can you give a example ?

  8. #7
    Join Date
    Apr 2009
    Location
    Trapped in my own little world.
    Posts
    2,487
    Rep Power
    33

    Re: Text when clicked a link

    Quote Originally Posted by barto90 View Post
    Can you tell me how to use this when clicked a link?
    Can you give a example ?
    Code:
    <script type="text/javascript">
        function 
    showStuff(id) {
            
    document.getElementById(id).style.display 'block';
        }
        function 
    hideStuff(id) {
            
    document.getElementById(id).style.display 'none';
        }
    </script>
    <a href="javascript:hideStuff('myDiv');">Hide</a> - <a href="javascript:showStuff('myDiv');">Show</a>
    <div id="myDiv" style="display:none;">I'm here!</div> 

  9. #8
    barto90 is offline Newbie
    Join Date
    Feb 2010
    Posts
    7
    Rep Power
    0

    Re: Text when clicked a link

    Alright i give that a try!

    Thanks in advance

  10. #9
    barto90 is offline Newbie
    Join Date
    Feb 2010
    Posts
    7
    Rep Power
    0

    Re: Text when clicked a link

    That's great!

    But can you also make it like,

    1 click visible
    second click hide, so the entire function underneath 1 hyperlink?

  11. #10
    ChrisBie is offline Newbie
    Join Date
    Mar 2010
    Posts
    4
    Rep Power
    0

    Re: Text when clicked a link

    Code:
    <script type="text/javascript">
        function 
    showStuff(id) {
            
    document.getElementById(id).style.display 'block';
        }
        function 
    hideStuff(id) {
            
    document.getElementById(id).style.display 'none';
        }
        
        function 
    showhideStuff(id) {
            
    document.getElementById(id).style.display 'none';
            
            var 
    State=document.getElementById('showhide').innerHTML
            
    if (State=='Show')
                {
            
    document.getElementById('showhide').innerHTML 'Hide';
            
    showStuff(id);
            
            }
            else
            {
            
    hideStuff(id)
            
    document.getElementById('showhide').innerHTML 'Show';
            }
        }
        
    </script>
    <a id='showhide' href="javascript:showhideStuff('myDiv');">Show</a> 
    <div id="myDiv" style="display:none;">I'm here!</div> 

Closed Thread
Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: 01-09-2011, 03:51 PM
  2. Display only what is clicked
    By dvelguru in forum JavaScript and CSS
    Replies: 0
    Last Post: 10-10-2009, 09:25 PM
  3. text-link-ads.com?
    By TcM in forum Search Engine Optimization
    Replies: 2
    Last Post: 09-02-2007, 12:18 AM
  4. Posting a link to a text field
    By holla22 in forum PHP Development
    Replies: 3
    Last Post: 07-19-2007, 04:16 PM
  5. Text Link ad Networks
    By Lop in forum Marketing
    Replies: 15
    Last Post: 05-24-2007, 01:12 PM

Tags for this Thread

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