/    Sign up×
Community /Pin to ProfileBookmark

Setting a default hyperlink

Hi,

I want to have a hyperling “highlighted” on a page such that if the visitor hit “return”, that link is activated and the page opened.

To clarify… if TAB is pressed repetedly, the hyperlinks are highlighted succesively. How do I set one of these to be the ‘starter’?

Kindest regards,
deej

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@balloonbuffoonJan 05.2006 — Here ya go:
[code=html]<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body onLoad="document.getElementById('firstlink').focus()">
<a href="http://" tabindex="1" id="firstlink" onFocus="this.style.backgroundColor='#FFFF00'" onBlur="this.style.backgroundColor=''">First Link</a>
<a href="http://" tabindex="2" onFocus="this.style.backgroundColor='#FFFF00'" onBlur="this.style.backgroundColor=''">Second Link</a>
<a href="http://" tabindex="3" onFocus="this.style.backgroundColor='#FFFF00'" onBlur="this.style.backgroundColor=''">Third Link</a>
<a href="http://" tabindex="4" onFocus="this.style.backgroundColor='#FFFF00'" onBlur="this.style.backgroundColor=''">Fourth Link</a>
</body>
</html>
[/code]

Just use that general pattern. You may find that you don't have to set the tabindex, so play around with it.

Good Luck!

--Steve
×

Success!

Help @deejayuk spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 9.23,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @ddiebold17,
tipped: article
amount: 1000 SATS,

tipper: @Mqlinka19,
tipped: live stream
amount: 4900 SATS,

tipper: @Mqlinka19,
tipped: article
amount: 10 SATS,
)...