0% found this document useful (0 votes)
20 views5 pages

Basic HTML Programs

The document provides a series of basic HTML programs demonstrating various elements such as headings, links, images, buttons, and tables, along with examples of inline, internal, and external CSS. It also includes instructions for downloading and setting up Visual Basic Code, as well as examples of JavaScript code for displaying messages and dates. Overall, it serves as a beginner's guide to HTML and JavaScript programming.

Uploaded by

im.mightyrajveer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
20 views5 pages

Basic HTML Programs

The document provides a series of basic HTML programs demonstrating various elements such as headings, links, images, buttons, and tables, along with examples of inline, internal, and external CSS. It also includes instructions for downloading and setting up Visual Basic Code, as well as examples of JavaScript code for displaying messages and dates. Overall, it serves as a beginner's guide to HTML and JavaScript programming.

Uploaded by

im.mightyrajveer
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

1.

Basic HTML Programs


<!DOCTYPE html>
<html>
<head>
<title> My first Program </title>
</head>
<body>
<h1>My First Heading</h1>
<h3> My First Heading </h1>
<p>My first paragraph.</p>
</body>
</html>

2. Using <a> tag


<!DOCTYPE html>
<html>
<body>
<h2>HTML Links</h2>
<p>HTML links are defined with the a tag:</p>
<a href="https://www.w3schools.com">This is a link</a>
</body>
</html>

3. Using <img> <button> tag


<!DOCTYPE html>
<html>
<body>
<h2>HTML Images</h2>
<p>HTML images are defined with the img tag:</p>
<img src="w3schools.jpg" alt="W3Schools.com" width="104" height="142">
<button>Click me</button>
</body>
</html>

4. HTML with Inline CSS


5.
<!DOCTYPE html>
<html>
<body>
<p>I am normal</p>
<p style="color:red;">I am red</p>
<p style="color:blue;">I am blue</p>
<p style="font-size:50px;">I am big</p>
</body>
</html>
6. HTML with Internal CSS
<!DOCTYPE html>
<html>
<head>
<style>
body {background-color: powderblue;}
h1 {color: blue;}
p {color: red;}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>

7. HTML with External CSS


<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>

8. HTML table with border


<!DOCTYPE html>
<html>
<head>
<style>
table, th, td {
border: 1px solid black;
}
</style>
</head>
<body>
<h2>Table With Border</h2>

<p>Use the CSS border property to add a border to the table.</p>

<table style="width:100%">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
<tr>
<td>John</td>
<td>Doe</td>
<td>80</td>
</tr>
</table>

</body>
</html>

9. Inserting script to HTML


<!DOCTYPE html>
<html>
<body>
<h2>Use JavaScript to Change Text</h2>
<p>This example writes "Hello JavaScript!" into an HTML element with id="demo":</p>

<p id="demo"></p>

<script>document.getElementById("demo").innerHTML = "Hello JavaScript!";


</script>

</body>
</html>

10.Input Button
<!DOCTYPE html>
<html>
<body>

<h2>The button Element</h2>

<button type="button" onclick="alert('Hello World!')">Click Me!</button>


</body>
</html>
Steps to download Visual Basic Code
1. Download the Visual Basic Code.
2. Download the Nodejs
3. After installing the Visual Basic Code, create a new folder in Desktop and give a
folder name as ‘Java’
4. Open a Visual Basic Code and in that open a terminal and set a execution policy -
C:\Users\Rajath\Desktop\Java> set-ExecutionPolicy RemoteSigned-
ScopeCurrentUser
5. Get-ExecutionPolicy Get-ExecutionPolicy-list
6. To create a file go a new file and type the program and save the program in javascript
extension example – program1.js
7. To run the prompt install – npm install prompt-sync
8. To run the program in the terminal use – node program name(filename).js

1. Display contents

Console.log(“Hello world”)

Save as program1.js
To run – node program1.js

2. Display the Date

var today = new Date();


console.log(today);

3. Display the hour now(Current hour)

Var today=new Date();


var hourNow = today .getHours();
console .log (hourNow);

4. Display a greeting to the user based upon the value passed

var greeting ; var hourNow =15 ;


if (hourNow > 18 )
{
greeting = 'Good -Morning' ;
console .log (greeting);
}
else if (hourNow >12 )
{
greeting = 'Good -Afternoon' ;
console .log (greeting);
}
else if (hourNow > 0 )
{
greeting = 'Good -Evening' ;
console .log (greeting);
}
else
{
greeting = 'welcome' ;
console .log (greeting);
}

You might also like