supermatchgame
Programmer
Hi,
I got some javascript from a web page that highlights the different rows in a datagrid when I roll my mouse over them:
The javascript makes reference to some CSS classes to decide what colour to make the row.
I want to make it so that when I click the mouse the row stays highlighted with another colour until I click another row. As you can see I have added
but while this highlights the row when I click on it, as soon as I roll my mouse over it the highlighting disappears.
I have never written javascript before - can anyone help me?
Thanks,
Mark.
I got some javascript from a web page that highlights the different rows in a datagrid when I roll my mouse over them:
Code:
<script language="javascript" type="text/javascript">
startHighlight = function()
{
if (document.all && document.getElementById)
{
navRoot = document.getElementById("dgResults");
tbody = navRoot.childNodes[0];
for (i = 1; i < tbody.childNodes.length - 1; i++)
{
node = tbody.childNodes[i];
if (node.nodeName == "TR")
{
node.onmouseover = function()
{
this.className = "over";
}
node.onmouseout = function()
{
this.className = this.className.replace("over", "");
}
node.onmousedown = function()
{
this.className = "under";
}
}
}
}
}
window.onload = startHighlight;
</script>
The javascript makes reference to some CSS classes to decide what colour to make the row.
I want to make it so that when I click the mouse the row stays highlighted with another colour until I click another row. As you can see I have added
Code:
node.onmousedown = function()
{
this.className = "under";
}
I have never written javascript before - can anyone help me?
Thanks,
Mark.