View Full Version : JavaScript - onmousedown
Osterling
12-29-2006, 09:34 PM
I am new to JavaScript, and I am playing with this line of code that to my knowledge is correct but it will not run. The code is:
<body onmousedown="document.bgcolor='#0000CC'">
I press the left mouse button down and it doesn't work; any ideas as to why?
peterska2
12-29-2006, 11:06 PM
without checking I believe the function is onMouseDown not onmousedown. Javascript functions are case senstive.
Osterling
12-30-2006, 01:11 AM
I have this <body onMouseDown="document.bgcolor='blue'"> and it still isn't changing the bgcolor. Anyone know why that is?
Adrian Schneider
12-30-2006, 01:22 AM
function updateBody()
{
document.getElementsByTagName('body')[0].style.background = 'blue';
}
document.getElementsByTagName('body')[0].onmousedown = updateBody;document.bgcolor isn't a valid...
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.