Is it possible to trigger a Javascript function when a link is single clicked but goto the actually link address if it's double clicked?
Say I have something like this:
Link 1 | Link 2 | Link 3
When triggered by one click, a second row below that row shows:
Sub-Link 1 | Sub-Link 2 | Sub-Link 3 |
but if the user double clicks the link, it loads that page.
Page 1 of 1
Single Click Load Javascript, Double Click Load Link
#2
Posted 19 January 2010 - 07:28 PM
I made a very basic (and i mean basic) example of what you are looking for 
Basically, a toggle for each of the div's + an ondblclick event for the main links
<html>
<head>
<script type="text/javascript">
function toggleRow(id){
if(id === "link1"){
document.getElementById('link1').style.display = 'block';
document.getElementById('link2').style.display = 'none';
document.getElementById('link3').style.display = 'none';
}
else if(id === "link2"){
document.getElementById('link1').style.display = 'none';
document.getElementById('link2').style.display = 'block';
document.getElementById('link3').style.display = 'none';
}
else if(id === "link3"){
document.getElementById('link1').style.display = 'none';
document.getElementById('link2').style.display = 'none';
document.getElementById('link3').style.display = 'block';
}
}
</script>
</head>
<body>
<div id="mainrow">
<a href="#" onclick="toggleRow('link1')" ondblclick="location.href='link1.htm';">Link 1</a> |
<a href="#" onclick="toggleRow('link2')" ondblclick="location.href='link2.htm';">Link 2</a> |
<a href="#" onclick="toggleRow('link3')" ondblclick="location.href='link3.htm';">Link 3</a> |
</div>
<!-- Rows -->
<div id="link1" style="display: none; background-color: #9ED6FF">
Sub link 1 | Sub link 2 | Sub link 3
</div>
<div id="link2" style="display: none; background-color: #FF0000">
Sub link 1 | Sub link 2 | Sub link 3
</div>
<div id="link3" style="display: none; background-color: #8EFF9B">
Sub link 1 | Sub link 2 | Sub link 3
</div>
</body>
</html>
Basically, a toggle for each of the div's + an ondblclick event for the main links


#3
Posted 25 January 2010 - 03:06 AM
Alright, got it to work.
http://makethemovieh.../menu_test.html
now I need it to default to Live Sound.
Any ideas?
http://makethemovieh.../menu_test.html
now I need it to default to Live Sound.
Any ideas?
Share this topic:
Page 1 of 1


Help


Promote to Article









