Uplne jednoduchy pripad:
Kód:
<html>
<head>
<script type="text/javascript">
function myfunction(txt)
{
alert(txt);
}
</script>
</head>
<body>
<form>
<input type="button" onclick="myfunction('Hello')" value="Call function">
</form>
</body>
</html>
toto funguje v poriadku, vypise Hello po kliknuti.
Avsak ja potrebujem mat tu javascript funkciu v externom subore, ale ked ju tam dam, uz to nefunguje.
Kód:
<html>
<head>
<script src="js/mojscript.js" type="text/javascript"></script>
</head>
<body>
<form>
<input type="button" onclick="myfunction('Hello')" value="Call function">
</form>
</body>
</html>
viete poradit?