Behseini
01-02-2011, 12:47 AM
Hi Guys,
I am tiring to create an external java script which is suppose to change a div background color when mouse over.
I have a simple Html file as:
<html>
<head>
<script type="text/javascript" src="MouseJs.js"></script>
<link rel="stylesheet" type="text/css" href="MouseCSS.css">
<title>Test Mouse Over</title>
</head>
<body>
<div class="box" id="col">
</div>
</body>
</html>
and a CSS file as:
.box {
width: 20%;
height: 100px;
background-color: #4D7530;
float:left;
}
and finally I have a java script file as bellow:
window.onload = function()
{
document.getElementById('col').onmouseover = function()
{
document.col.background-color: #FFFFFF;
}
}
Could you please let me know what i am doing wrong here?
Thanks
I am tiring to create an external java script which is suppose to change a div background color when mouse over.
I have a simple Html file as:
<html>
<head>
<script type="text/javascript" src="MouseJs.js"></script>
<link rel="stylesheet" type="text/css" href="MouseCSS.css">
<title>Test Mouse Over</title>
</head>
<body>
<div class="box" id="col">
</div>
</body>
</html>
and a CSS file as:
.box {
width: 20%;
height: 100px;
background-color: #4D7530;
float:left;
}
and finally I have a java script file as bellow:
window.onload = function()
{
document.getElementById('col').onmouseover = function()
{
document.col.background-color: #FFFFFF;
}
}
Could you please let me know what i am doing wrong here?
Thanks