Mephist0222
Programmer
am working on a script that will focus on the first link in a set when the page loads, will go down one link when you trigger one function and stop at the end and go up one link when you trigger another function and stop at the top.
I have it sort of working but it is not 100%
<style>
a.link:hover, a.link:active, a.link:focus{
border: solid 1px #000;
background: #ff9;
}
</style>
<script>
var links = document.getElementsByTagName("a");
for(var i=0; i < links.length; i++) {
if(links.className == 'link'){
if(links.blur){
links[0].focus()
}
function arrDwn() {
if(links.focus){
links[i++].focus()
}
}
function arrUp() {
if(links.focus){
links[i--].focus()
}
}
}
break;
}
</script>
<a href="me" class="link" name="mine">Link</a><br/>
<a href="me" class="link" name="mine">Link</a><br/>
<a href="me" class="link" name="mine">Link</a><br/>
<a href="me" class="link" name="mine">Link</a><br/>
<a href="me" class="link" name="mine">Link</a><br/>
<a href="me" class="link" name="mine">Link</a><br/>
<a href="me" class="link" name="mine">Link</a><br/>
<br/>
<br/>
<a href="javascript:arrDwn();">Down</a>
<a href="javascript:arrUp();">Up</a>
I have it sort of working but it is not 100%
<style>
a.link:hover, a.link:active, a.link:focus{
border: solid 1px #000;
background: #ff9;
}
</style>
<script>
var links = document.getElementsByTagName("a");
for(var i=0; i < links.length; i++) {
if(links.className == 'link'){
if(links.blur){
links[0].focus()
}
function arrDwn() {
if(links.focus){
links[i++].focus()
}
}
function arrUp() {
if(links.focus){
links[i--].focus()
}
}
}
break;
}
</script>
<a href="me" class="link" name="mine">Link</a><br/>
<a href="me" class="link" name="mine">Link</a><br/>
<a href="me" class="link" name="mine">Link</a><br/>
<a href="me" class="link" name="mine">Link</a><br/>
<a href="me" class="link" name="mine">Link</a><br/>
<a href="me" class="link" name="mine">Link</a><br/>
<a href="me" class="link" name="mine">Link</a><br/>
<br/>
<br/>
<a href="javascript:arrDwn();">Down</a>
<a href="javascript:arrUp();">Up</a>