Active Menu

Active Menu

Java Script

<script>
function selected(obj){
var lilist = document.getElementById(‘menu’);
var alist = lilist.getElementsByTagName(‘a’);
for (i=0; i<alist.length; i++ )
{
alist[i].className=””;
}
obj.className=”red”;
}
</script>

Style
<style>
.red {
color:red;
background:#F39;
width:150px;
}

HTML
<ul id=”menu”>
<li><a href=”#” onClick=”selected(this)”>Home</a></li>
<li><a href=”#”  onClick=”selected(this)”>About Us</a></li>
<li><a href=”#”  onClick=”selected(this)”>Our Products</a></li>
<li><a href=”#” onClick=”selected(this)”>Trade Offers</a></li>
<li><a href=”#”  onClick=”selected(this)”>Contact Us</a></li>
</ul>

0

How To Disable Right Click and Ctrl Key

<script type=”text/javascript”>
var isNS = (navigator.appName == “Netscape”) ? 1 : 0;

if(navigator.appName == “Netscape”) document.captureEvents(Event.MOUSEDOWN||Event.MOUSEUP);

function mischandler(){
return false;
}

function mousehandler(e){
var myevent = (isNS) ? e : event;
var eventbutton = (isNS) ? myevent.which : myevent.button;
if((eventbutton==2)||(eventbutton==3)) return false;
}
document.oncontextmenu = mischandler;
document.onmousedown = mousehandler;
document.onmouseup = mousehandler;
var isCtrl = false;
document.onkeyup=function(e)
{
if(e.which == 17)
isCtrl=false;
}

document.onkeydown=function(e)
{
if(e.which == 17)
isCtrl=true;
if(((e.which == 85) || (e.which == 117) || (e.which == 65) || (e.which == 97) || (e.which == 67) || (e.which == 99) || (e.which == 112) ) && isCtrl == true)
{
// alert(‘Keyboard shortcuts are cool!’);
return false;
}
}
</script>

0