G
getsanjay.sharma
Hello all, I have been trying to implement a script using which when
the user clicks on one of the two span tags, its text is highlighted
while the same happens when the user clicks on the second one, except
that the first one loses its highlight. I am at a loss as to why this
code doesn't work.
<html>
<head>
<script language="javascript" type="text/javascript">
<!--
function changeOne(s)
{
document.getElementById(s).style.fontWeigth = "bold";
document.getElementById("two").style.fontWeight = "normal"
}
function changeTwo(s)
{
document.getElementById(s).style.fontWeight = "bold";
document.getElementById("one").style.fontWeight = "normal";
}
-->
</script>
</head>
<body>
<form>
<span id="one" onClick="changeOne('one');">Hello</span>
<br /><br />
<span id="two" onClick="changeTwo('two');">World</span>
</form>
</body>
</html>
Any kind of help would be appreciated.
the user clicks on one of the two span tags, its text is highlighted
while the same happens when the user clicks on the second one, except
that the first one loses its highlight. I am at a loss as to why this
code doesn't work.
<html>
<head>
<script language="javascript" type="text/javascript">
<!--
function changeOne(s)
{
document.getElementById(s).style.fontWeigth = "bold";
document.getElementById("two").style.fontWeight = "normal"
}
function changeTwo(s)
{
document.getElementById(s).style.fontWeight = "bold";
document.getElementById("one").style.fontWeight = "normal";
}
-->
</script>
</head>
<body>
<form>
<span id="one" onClick="changeOne('one');">Hello</span>
<br /><br />
<span id="two" onClick="changeTwo('two');">World</span>
</form>
</body>
</html>
Any kind of help would be appreciated.