[go: up one dir, main page]

0% found this document useful (0 votes)
54 views4 pages

Javascript Get Date Methods: Method Description

The document discusses several topics related to HTML and JavaScript: 1. It provides code to style different types of links in HTML. 2. It lists several date-related methods in JavaScript like getFullYear() and getMonth() to retrieve date information. 3. It demonstrates how to validate form fields in JavaScript, such as validating that a name field is not empty and validating that a numeric field is between 1-10. 4. It discusses considerations for hosting a website, such as choosing a hosting provider and deciding between static and dynamic website types.

Uploaded by

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

Javascript Get Date Methods: Method Description

The document discusses several topics related to HTML and JavaScript: 1. It provides code to style different types of links in HTML. 2. It lists several date-related methods in JavaScript like getFullYear() and getMonth() to retrieve date information. 3. It demonstrates how to validate form fields in JavaScript, such as validating that a name field is not empty and validating that a numeric field is between 1-10. 4. It discusses considerations for hosting a website, such as choosing a hosting provider and deciding between static and dynamic website types.

Uploaded by

shamagondal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

HTML:-

1. HTML links:-

<!DOCTYPE html>
<html>
<head>
<style>
a:link {
color: green;
background-color: transparent;
text-decoration: none;
}
a:visited {
color: pink;
background-color: transparent;
text-decoration: none;
}
a:hover {
color: red;
background-color: transparent;
text-decoration: underline;
}
a:active {
color: yellow;
background-color: transparent;
text-decoration: underline;
}
</style>
</head>
<body>

<h2>Link Colors</h2>

<p>You can change the default colors of links</p>

<a href="html_images.asp" target="_blank">HTML Images</a>

</body>
</html>

JAVASCRIPT

1. Control Structure:-
Ans :-Conditional statements and Loops are the controls.

2. METHODS:-
Ans :- Pre defined methods and Properties are in javascript
JavaScript Get Date Methods

Method Description
getFullYear() Get the year as a four digit number (yyyy)
getMonth() Get the month as a number (0-11)
getDate() Get the day as a number (1-31)
getHours() Get the hour (0-23)

3. VALIDATION:-

JavaScript Form Validation


HTML form validation can be done by JavaScript.

If a form field (fname) is empty, this function alerts a message, and returns
false, to prevent the form from being submitted:

A:- String Validation

<!DOCTYPE html>
<html>
<head>
<script>
function validateForm() {
var x = document.forms["myForm"]["fname"].value;
if (x == "") {
alert("Name must be filled out");
return false;
}
}
</script>
</head>
<body>

<form name="myForm" action="/action_page.php"


onsubmit="return validateForm()" method="post">
Name: <input type="text" name="fname">
<input type="submit" value="Submit">
</form>

</body>
</html>

B. Numeric Validation:-

<!DOCTYPE html>
<html>
<body>

<h2>JavaScript Can Validate Input</h2>


<p>Please input a number between 1 and 10:</p>

<input id="numb">

<button type="button" onclick="myFunction()">Submit</button>

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

<script>
function myFunction() {
var x, text;

// Get the value of the input field with id="numb"


x = document.getElementById("numb").value;

// If x is Not a Number or less than one or greater than 10


if (isNaN(x) || x < 1 || x > 10) {
text = "Input not valid";
} else {
text = "Input OK";
}
document.getElementById("demo").innerHTML = text;
}
</script>

</body>
</html>

4. HOSTING YOUR SITES:-

The first thing to consider when starting your website is to choose a web hosting provider (if
you already have a web domain1). The web hosting provider provides the web space (i.e.
special computers called web servers) where your website files are stored, as well as
the technologies and services needed for your website to be viewed on the Internet.

You can buy your domain and hosting from multiple providers, including HostGator India. But
did you know that HostGator India’s award-winning hosting services are ideal for pros and
beginners with little or no technical skills? They offer you a super easy way to set up (with
just one click) and manage your website cost-effectively with:

Step 1: Decide What Type of Website You Want

You will typically find 2 types of websites:

 Static or Basic Websites: Static websites are simple websites with one or more web pages
(called HTML pages). You can build them on your computer with software like Dreamweaver
and then upload the pages to your host’s server using any FTP software (such as FileZilla).

You might also like