• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

problem with hyperlink

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hello,


when i run the above code i get 2 hyperlink initially in blue color. when i click the "link1" the javascript alert window is displayed. the color of the link changed to purple. then i clicked the "link2" the page loaded and displayed google's homepage. now when i go back to the previous page the "link2" hypelink's color changed to purple but the "link1" hypelink color remains in blue.

can any one help me to change the hyperlink color of "link1" to purple as defined in the stylesheet.
 
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since there's no real link, there's nothing for the browser to store to remember that you've clicked upon it. In other words: I think you are out of luck.
 
Srikanthh Ar
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is there any way to treat "link1" as a real link. so that color of the hyperlink can be changed?. or suggest any other way.
 
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
pseudo styles:

 
salvin francis
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
pseudo styles:




however, as bear stated, its not a real link, so when you click back ...
the javascript one will not be in purple.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ideally you would not write the link that way



Eric
 
Srikanthh Ar
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@salvin francis

when i use this code


initially the "link1" is in blue color. after clicking "link2" and coming back the color of the "link1" remains in blue.

@Eric


when i use this the "link1" doesn't act like a hyperlink. i am unable to click the link.


 
Bear Bibeault
Sheriff
Posts: 67750
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No href means no link.
 
Srikanthh Ar
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
no href means no link.. i am clear with that.


color of the "link1" is changing in the active page. but when clicking the other link(link2) and coming back to the same page the color wasn't changed.
is there any way to change the color of the "link1" or any other way to highlight the visited link. (i.e) to show that this link is already clicked
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The link has no clue if it was vsted since it has no entry in history. Only way to make sure it has color is you will have to do it yourself with cookies or backend coding.

My previous code got screwed by the jForum code. This is what it was supposed to look like:


inti() would have to cancel the event bubbling or it could use return false.

Eric
 
salvin francis
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
keep in mind though that href=# has a very nasty functionality of scrolling page to top.
 
Eric Pascarello
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

salvin francis wrote:keep in mind though that href=# has a very nasty functionality of scrolling page to top.



Not if you cancel the click like I mentioned.

Eric
 
salvin francis
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Eric Pascarello wrote:

salvin francis wrote:keep in mind though that href=# has a very nasty functionality of scrolling page to top.



Not if you cancel the click like I mentioned.

Eric


Wow thats interesting,
I havent tried that, but if that cancels the "scroll-to-top", then I really am impressed.
 
Blueberry pie is best when it is firm and you can hold in your hand. Smell it. And smell this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic