<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?
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.