I discover something interesting recently.
Many beginners already know that but for some unknown reason quite often forgot about it.
Apparently, many people have a weird problem with ... call function with parameter from external javascript file.
Some solutions are quite confusing, so here you can find easiest solution :
our html file looks:
<html>
<head>
<script type="text/javascript" src="js/message.js"></script>
</head>
<body>
<script type="text/javascript">
showMessage("This message is sent as parameter")
</script>
</body>
</html>
our js file looks:
function showMessage(text) {
alert(text);
}
That's it.
DOMINIK SYMONOWICZ's blogs - FOREVER HUNGRY of knowledge, sarcasm, smiling, music, dancing, and food ...lots of food. This IT blog is a collection of notes with a simple solution with an explanation, added documentation, sarcastic comment and weird example. I also write about a lesson learnt from my mistakes. A non-it blog can be found here: Dominik Symonowicz's non-IT blog and website
Showing posts with label function. Show all posts
Showing posts with label function. Show all posts
Subscribe to:
Posts (Atom)