www.webdeveloper.com
Results 1 to 4 of 4

Thread: a special function

  1. #1
    Join Date
    Oct 2011
    Posts
    9

    a special function

    Hi, I need a java code for a special kind of hyperlink. Please help me in this regard. I want it this way:

    When you click on the link for the first time, a text box appears including, say, "A".
    When you click on the link for the second, third, forth,.... times, a text box appears including, say, "B".

    That is, for the first consultation of the link, one thing is displayed; in further consultations, something else is shown.

    Thanks.

  2. #2
    Join Date
    Mar 2007
    Location
    U.K.
    Posts
    1,127
    Code:
    <a href="#" onclick = 'alert( this.wasClicked ? "B" : "A" ); this.wasClicked = true; return false;'>GO</a>

  3. #3
    Join Date
    Dec 2003
    Location
    Bucharest, ROMANIA
    Posts
    15,428
    Quote Originally Posted by nasscript View Post
    Hi, I need a java code
    Java is not JavaScript. Different languages.

  4. #4
    Join Date
    Oct 2011
    Posts
    9
    Quote Originally Posted by Logic Ali View Post
    Code:
    <a href="#" onclick = 'alert( this.wasClicked ? "B" : "A" ); this.wasClicked = true; return false;'>GO</a>
    Thanks a million for your reply and your help. I want another JavaScript for the following condition. That may be bothersome for you but I greatly appreciate your help.
    Imagine that we have the following line with the underlined words functioning as links.

    This time tomorrow, we would get there. The time is passing quickly and I wonder if we could stay here longer.

    I want the above links to function as follows. The result may appear in a new window, a new frame, a toolbox, a tooltip or whatever. It does not matter. To me the way of presenting the result is important which is as follows.
    1) By clicking on "there" for the first time, the word "BOSTON" appears.
    2) By clicking on "here" for the first time, the word "LONDON" appears.
    3) After both links are consulted once and in a sequential order (that is, first "there" is clicked on, then "here"), by clicking on either "there" or "here" for the second, third, fourth, times, the word "LONDON" appears.


    Because you are a professional in JavaScript, please also share me name of some books or websites in which I could learn JavaScript step by step from beginning to advanced levels. You have been of great help to me. Thanks in advance and God bless you.

Thread Information

Users Browsing this Thread

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

Posting Permissions

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



Recent Articles