...

View Full Version : function is not getting called from external javascript



san_crazy
09-10-2008, 02:06 PM
I wrote following script



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


<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_VxN3sQ6ZDAn2tepoUHi7UJ2xsIvlJYRTjBE3JMyu0V5EWkGCW19R7AJtU9VBo B1gvzCOa_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?

Philip M
09-10-2008, 02:23 PM
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.

san_crazy
09-10-2008, 03:34 PM
yeah!!!!!

I am surprised, it has automatically been solved.

thanks anyway



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum