External use of Java Script
Java Script code of the page you want to use the same, or greater than the amount of code you are using external Java Script. Head and bodi sesanei both external Java script can be used. In an editor, with the exception of tags (<script> ...... </ script> , just java script's code will be required. Such as:
function Salam () {
alert ("Salam from www.hedaet.com")
The file ". Js" extension can be saved with a. Then write an HTML code, where <script> tag's src attribute of the. Js file's location to be announced. Such as:
<html>
<head>
<script type="text/javascript" src="filename.js"> </ script>
</ head>
<body>
.......
</ body>
</ html>
The code does not "something.html" in the name is to be saved .. The HTML file and Java Script
There seem to be on the same directory.
==========
এক্সটারনাল জাভা স্ক্রীপ্ট এর ব্যবহার
একই জাভা স্ক্রীপ্ট কোড বিভিন্ন পেজ এ ব্যবহার করতে চাইলে, বা কোডের পরিমাণ বেশী হলে, এক্সটারনাল জাভা স্ক্রীপ্ট এর ব্যবহার করা হয়। হেড ও বোডি উভয় সেশনেই এক্সটারনাল জাভা স্ক্রীপ্ট এর ব্যবহার করা যায়। কোন এডিটর এর মধ্যে, ট্যাগ বাদে ( <script>......</script> শুধু জাভা স্ক্রীপ্ট এর কোড লিখতে হবে। যেমন:
function Salam() {
alert("Salam from www.hedaet.com")
এরপর ফাইল টি ".js" extension দিয়ে সেভ করতে হবে।এরপর একটি HTML কোড লিখতে হবে, যেখানে <script> ট্যাগ এর src এট্রিবিউট এর মাধ্যমে ঐ .js ফাইল এর লোকেশন জানিয়ে দিতে হবে। যেমন:
<html>
<head>
<script type="text/javascript" src="filename.js" ></script>
</head>
<body>
.......
</body>
</html>
এরপর কোড টি “something.html” নাম দিয়ে সেভ করতে হবে।। তখন HTML file এবং জাভা স্ক্রীপ্ট
একই directory তে আছে বলে মনে হবে।
|