Hi, I just started learning javascript a couple days ago and i was curious from the beggining how to reference a js file in html. I learned How to call the file but im not sure how to access the js file's functions.
simple example :
javascript file -- named hi.js
<script type="text/javascript">
function MsgBox (mine) {
alert (mine) }
</SCRIPT>
html file with a refernce to the js file -- html file named sample.html
(their located in the sme dir)
<html> <head> <script type="text/javascript" src="hi.js"></script> </head> <BODY> <FORM> <INPUT NAME="text1" TYPE=Text> <INPUT NAME="submit" TYPE=Button VALUE="Show Me" onclick="MsgBox(form.text1.value)"> </FORM> </body> </html>
Any help would be great...Thanks...
Shadow_x21

New Topic/Question
Reply



MultiQuote




|