Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Sep 2011
    Posts
    27
    Thanks
    8
    Thanked 0 Times in 0 Posts

    I can’t pass property to the function

    Hi all! I can`t pass properties to function. I already had this problem before and i've resolved it with the help of

    Old Pedant, Mr J and DaveyErwin. Now I have the same problem and have no idea how to solve it


    The error is “Esperaba un objeto“ (“an object expected”)


    Could anyone help me please?


    Here is my code:

    Code:
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    
    <html lang="en">
      <head>
    	  <title>Problem</title>
        <link rel="stylesheet" href="estilos.css" type="text/css" media="all">
        <style type="text/css">
    		
    		</style>
       	<script type="text/javascript">
    		
    		function hide(elem)
    {
     var vis = document.getElementById(elem)
     
     vis.style.visibility="hidden";
    
    }
    		</script>
    
      </head>
      <body>
    			<div id="myimage">
    		
    		  <img src="img.png"   onclick="hide(menu1)" width=50 height=50 border=0 alt=unit.name />
    			<div id="menu1" class="soldmenu">
    			 <ul>
    			   <li>aaaa</li>
    				 <li>bbbbbbbbbb</li>
    				 <li>ccccccc</li>
    			</ul>
    		</div>
    		
     </body>
    </html>

  • #2
    Regular Coder
    Join Date
    Aug 2010
    Posts
    972
    Thanks
    19
    Thanked 212 Times in 210 Posts
    onclick="hide(menu1)"
    should be
    onclick="hide('menu1')"

  • Users who have thanked DaveyErwin for this post:

    Drunklord (10-16-2011)

  • #3
    New Coder
    Join Date
    Sep 2011
    Posts
    27
    Thanks
    8
    Thanked 0 Times in 0 Posts
    I've tried it so many times that i missed this detail.
    thank you very match


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •