Clicked Link Countdown

Reply

Join Date: Aug 2005
Posts: 102
Reputation: martinkorner is an unknown quantity at this point 
Solved Threads: 0
martinkorner's Avatar
martinkorner martinkorner is offline Offline
Junior Poster

Re: Clicked Link Countdown

 
0
  #11
Feb 18th, 2006
Originally Posted by tgreer
To further enhance your script, research JavaScript arrays. As each link is clicked, you could store it's ID in an array. Then, check to see if the current ID (x.id) is alreadly in the array. If it is, they've already clicked that link. Change the text to read "please click a different link" or something like that.

You can also remove links they've already clicked. Check into "CSS visibility".
Would I use "OnClick" for these?

If yes, how do I have 3 functions in one OnClick?

If no, please help.

Sorry I'm stupid :o
Martin
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 1,655
Reputation: tgreer is an unknown quantity at this point 
Solved Threads: 35
Team Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: Clicked Link Countdown

 
0
  #12
Feb 20th, 2006
You can pack as many JavaScript statements as you like into a single function.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 102
Reputation: martinkorner is an unknown quantity at this point 
Solved Threads: 0
martinkorner's Avatar
martinkorner martinkorner is offline Offline
Junior Poster

Re: Clicked Link Countdown

 
0
  #13
Feb 20th, 2006
How do insert the css visibility command?
I tried putting it straight into javascript but this didn't work:
HTML and CSS Syntax (Toggle Plain Text)
  1. <script type="text/javascript">
  2. function visibility()
  3. {
  4. visibility: hidden
  5. }
  6. </script>
and
HTML and CSS Syntax (Toggle Plain Text)
  1. <a href="#" id="link_04" onclick="visibility();return link_click(this);">Search Engine</a><br />
but this didn't work - how would I do this?

Thanks
Martin
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 1,655
Reputation: tgreer is an unknown quantity at this point 
Solved Threads: 35
Team Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: Clicked Link Countdown

 
0
  #14
Feb 21st, 2006
CSS declarations don't go in your scripts. They are in a separate "style" section entirely. However, your script can change a style.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 102
Reputation: martinkorner is an unknown quantity at this point 
Solved Threads: 0
martinkorner's Avatar
martinkorner martinkorner is offline Offline
Junior Poster

Re: Clicked Link Countdown

 
0
  #15
Feb 21st, 2006
Originally Posted by tgreer
CSS declarations don't go in your scripts. They are in a separate "style" section entirely. However, your script can change a style.
I've got this code in the head:
HTML and CSS Syntax (Toggle Plain Text)
  1. <script language="JavaScript">
  2. function toggleVisibility(me){
  3. if (me.style.visibility=="hidden"){
  4. me.style.visibility="visible";
  5. }
  6. else {
  7. me.style.visibility="hidden";
  8. }
  9. }
  10. </script>

And in the body I've got:
HTML and CSS Syntax (Toggle Plain Text)
  1. <a href="#" id="link_04" onclick="toggleVisibility(this)" style="position:absolute">Search Engine</a>
This makes the link invisible when it's clicked, but it still takes up the space.

Is it possible to remove the space it took up when it was visible aswell?
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 102
Reputation: martinkorner is an unknown quantity at this point 
Solved Threads: 0
martinkorner's Avatar
martinkorner martinkorner is offline Offline
Junior Poster

Re: Clicked Link Countdown

 
0
  #16
Feb 21st, 2006
OK - Ignore the previous post.

I just worked it out!

In the head I put:
HTML and CSS Syntax (Toggle Plain Text)
  1. <script language="JavaScript">
  2. function toggleDisplay(me){
  3. if (me.style.display=="none"){
  4. me.style.display="inline";
  5. }
  6. else {
  7. me.style.display="none";
  8. }
  9. }
  10. </script>
And in the Link I put:
HTML and CSS Syntax (Toggle Plain Text)
  1. <a href="http://www.google.com" id="link_04" onclick="toggleDisplay(this);return link_click(this);" style="display:block">Search Engine</a>

WOW - I'm quite proud of myself for working that out!

Thanks for all your help in this thread tgreer!:lol:
Martin
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 1,655
Reputation: tgreer is an unknown quantity at this point 
Solved Threads: 35
Team Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: Clicked Link Countdown

 
0
  #17
Feb 21st, 2006
Note, though, that completely removes the link, instead of just making it invisible. A subtle difference. Try using "style.visibility=visible" and "style.visibility=hidden" instead. Compare the differences, and decide which you'd like to use, "visibility" or "display".
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 102
Reputation: martinkorner is an unknown quantity at this point 
Solved Threads: 0
martinkorner's Avatar
martinkorner martinkorner is offline Offline
Junior Poster

Re: Clicked Link Countdown

 
0
  #18
Feb 22nd, 2006
Originally Posted by tgreer
Note, though, that completely removes the link, instead of just making it invisible. A subtle difference. Try using "style.visibility=visible" and "style.visibility=hidden" instead. Compare the differences, and decide which you'd like to use, "visibility" or "display".
Thanks, but display's the one I want.

Thanks again
Martin
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 1,655
Reputation: tgreer is an unknown quantity at this point 
Solved Threads: 35
Team Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: Clicked Link Countdown

 
0
  #19
Jun 28th, 2006
Sorry for the late reply. The answer is "yes". Research the CSS "display" attribute. Setting it to display: none; will cause the element to not render, which removes any space it would normally consume on the page.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 102
Reputation: martinkorner is an unknown quantity at this point 
Solved Threads: 0
martinkorner's Avatar
martinkorner martinkorner is offline Offline
Junior Poster

Re: Clicked Link Countdown

 
0
  #20
Jun 28th, 2006
Thanks..

Martin
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the HTML and CSS Forum


Views: 4647 | Replies: 19
Thread Tools Search this Thread



Tag cloud for HTML and CSS
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC