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
    Regular Coder
    Join Date
    Sep 2008
    Posts
    116
    Thanks
    2
    Thanked 0 Times in 0 Posts

    function is not getting called from external javascript

    I wrote following script

    Code:
    function show_menu_pages(menu_args)           
    	  {	     
                
    	     if(menu_args=="home")		   
    		  {		 
    	          window.open('http://localhost/WebSite/homepage.html','_parent','','');
                       
    			 
    		  } 
    	
    	  	     
    	     if(menu_args=="interest")		   
    		  {		 
    	         window.open('http://localhost/WebSite/interestspage.html','_parent','','');
    			 
    		  } 
                
    	  }
    and the html code snippet
    Code:
     
    <html>
      <head>
          <script language="javascript" type="text/javascript" src="http://localhost/WebSite/externals/scripts/showpage.js"></script>
      </head>
       
      <body>
           <input onclick="javascript:show_menu_pages('home')" style="position:absolute; left: 3&#37;; top: 3% "  title="Home" type="image" name="" value="Home" src="http://images.orkut.com/orkut/albums3/ATUAAAAyKldQQ9gs8VK3W_zH4xemWwBi7RboeTY-Qgp5w-GNb2e1TacR9I0bZqMw7UsrG5W4AoV7W6d8fZbG0_l-4cwnAJtU9VDRWV-0d-p5Lr6d_8tcO3w-zjoatg.jpg">
    	 <input onclick="javascript:show_menu_pages('interest')" style="position:absolute; left: 3%; top: 8% " type="image" name="interest"  value="See" src="http://images.orkut.com/orkut/albums3/ATUAAACaxeATh4Si8c5iaCZMRp6QiqUIk8_0L6_VxN3sQ6ZDAn2tepoUHi7UJ2xsIvlJYRTjBE3JMyu0V5EWkGCW19R7AJtU9VBoB1gvzCOa_x3hdNMgP49ELF2Ebg.jpg">
      </body>
    </html>

    but when i click on input element, nothing happens like the function is not getting called.

    what mistake am i doing?

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,013
    Thanks
    203
    Thanked 2,538 Times in 2,516 Posts
    The function is being called. To prove this, place alerts, so:

    function show_menu_pages(menu_args) {
    alert ("Alert 1")
    if(menu_args == "home") {
    alert ("Alert 2")
    window.open('http://localhost/WebSite/homepage.html','_parent','','');
    }


    Quizmaster: Which of the three British armed forces is known as "the senior service"?
    Contestant: The SS.

  • #3
    Regular Coder
    Join Date
    Sep 2008
    Posts
    116
    Thanks
    2
    Thanked 0 Times in 0 Posts
    yeah!!!!!

    I am surprised, it has automatically been solved.

    thanks anyway


  •  

    Posting Permissions

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