Is my calling of javascript is correct?

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
dude81
Forum Regular
Posts: 509
Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City

Is my calling of javascript is correct?

Post by dude81 »

Code: Select all

<title>Remote script access Test</title>
<script language="javascript" type="text/javascript" src="http://remoteserver/myapp/name.js"></script>
<script language="javascript" type="text/javascript">
function test(name)
{
                alert("Hi");
	var name = new Name();
                 alert("Class Works");
}
</script>
</head>
<body>
<form>
<input type="text" name="text_val" value="">
<input type="button" value="" onClick="test(text_val.value)">
</form>
</body>
</html>
Hi, Whats wrong with this javascript. It doesn't access the remote class defined in name.js i.e browser alerts "Hi" but not "class works" and firefox error console gives Name not defined. Where Am I doing wrong?
choppsta
Forum Contributor
Posts: 114
Joined: Thu Jul 03, 2003 11:11 am

Post by choppsta »

Sounds like the remote js file isn't loading. If you're using Firefox, and haven't already, get Firebug. It will let you see the contents of any scripts included in the page. This should tell you whether it's loaded or not.
Post Reply