- Forums
- Javascipt
- How To Insert Javascript Code Into HTML Pages
This Page Contains information about How To Insert Javascript Code Into HTML Pages By web hosting in category Javascipt with 1 Replies. [2163], Last Updated: Mon Jun 24, 2024
web hosting
Sat Apr 19, 2008
1 Comments
644 Visits
the first thing you will need a HTML document for your script, here is a blank html document, this is the defaults tags you will need to use.
HTML TEMPLATE
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Webune Javascript Tutorial</title>
</head>
<body>
</body>
</html>
now that you have a plain html document we can use this template to insert our javascript
now lets create a file called
step 1. open your text editor (like notepad if you have windows)
step 2. copy and paste the following code into a blank notepad
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Webune Javascript Tutorial</title>
</head>
<body>
<B>This is part of the HTML document!</B>
<P>
<SCRIPT language="JavaScript">
<!--
document.write("This is from Javascript Code!");
//-->
</SCRIPT>
<P>
<B>Now back to the part of the HTML document!</B>
</body>
</html>
step3. save this file as
webune-javascript.html and open it with your web browser. you should see a single like of text that was written with Javascript
now when you open this file with your browser it will look like this:
DEMO
This is part of the HTML document!
Now back to the part of the HTML document!
https://www.webune.com/forums/how-to-insert-javascript-code-into-html-pages.html