CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Other Programming Languages: Javascript:
how to use parameter for object?

 



tack
Novice

Aug 18, 2003, 5:17 AM

Post #1 of 2 (29435 views)
how to use parameter for object? Can't Post


Code
<script> 
<!--//
function menu(ide,where){
if(where=='in'){
document.all.ide.style.background='555555';
}

if (where=='out'){

document.all.ide.style.background='ffffff';
}
//-->
</script>
<table width=100%>
<tr>
<td id='a'>
<a href="#" onMouseover="menu('a','in');" onMouseout="menu('a','out')">try</a><br>
</td>
</tr>
</table>



the code met error:can find the 'ide' object. my 'ide' here is 'a' .'ide' is only a parameter.how to use parameter for object? can you help me ? thanks!


OwChallie
Novice

Jan 4, 2005, 3:59 AM

Post #2 of 2 (29234 views)
Re: [tack] how to use parameter for object? [In reply to] Can't Post

Hi, if you still need this, when you pass 'a' as a parameter to your function, you are passing the letter 'a' and not the variable a, so it should look something like this:


Code
  

<script>
<!--//
function menu(ide, where)
{
if(where=='in')
{
ide.style.background='555555';
}
if (where=='out')
{
ide.style.background='ffffff';
}
}
//-->
</script>

<table width=100%>
<tr><td id="a"><a href="#" onMouseover="menu(a,'in');" onMouseout="menu(a,'out')">try</a><br></td></tr>
</table>


 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives