...

View Full Version : Function and argument - "...." is not an object



Phip
10-26-2003, 01:57 AM
<head>
<script type="text/javascript">

function inputOver(fname,field)
{
document.fname.field.style.background='#95aabf';
}
</script>
</head>
<body>
<form id="form" action="(EmptyReference!)" method="get" name="form">
<input class="text" type="text" name="text1" size="24" border="0" onmouseover="inputOver('form','text1')" />
</form>
</body>

Phip
10-26-2003, 02:11 AM
Simplified it a little ^^

Basscyst
10-26-2003, 02:34 AM
Hello -

You can use document.getElementById and it seems to work.

<head>
<script type="text/javascript">

function inputOver(fname)
{
document.getElementById(fname).style.background='#95aabf';
}
</script>
</head>
<body>
<form id="form" action="(EmptyReference!)" method="get" name="form1">
<input class="text" type="text" id="text1" name="text1" size="24" border="0" onmouseover="inputOver('text1')" />
</form>
</body>

Basscyst

liorean
10-26-2003, 02:40 PM
<input .... onmouseover="inputOver(this);" ...>

function inputOver(field) {
field.style.backgroundColor='#95aabf';
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum