1 / 3
amogtech
2 / 3
mhk
3 / 3
ccg


1. Create a new folder and name it. (eg. JavaScript Test)

2. Open text editor and write the following codes.

 

var txt = "<b>Welcome to TNW (Web Service & ICT Solutions)!</b><br /><br /> TNW provides the best ICT Solutions for your business by the reasonable price.";
function myFun(){
    document.getElementById("demo").innerHTML = txt;
}

 

3. Save the file as tnw.js in the new folder.

 

Now, we have already created the javascript file and that file will be used in html file.

 

1. Create new file and write the following codes.

 

<html>
<head>
<title>TNW (Web Service & ICT Solutions)</title>
<script src = "C:\Users\TNW\Desktop\JavaScript Test\tnw.js"></script>
</head>
<body>
<p id = "demo">TNW</p>
<button type = "button" onclick = "myFun()">Click Here</button>

</body>
</html>

 

2. Save the file as tnw.html in the new folder and try to open it.


Share On:

What do you think?

Send us feedback!