Skip to main content

Posts

Showing posts from November, 2016

Calculator Example using javascript

<!DOCTYPE html> <html>     <head>     <title>Simple Calculator</title> <meta name="viewport" content="width=device-width, initial-scale=1">     </head> <body>  <FORM name="Keypad" action=""> <input name="ReadOut" id="output" type="Text" size=24 value="0" readonly>     <table> <tr>   <td><input id="btn7" type="Button" value="  7  " onclick="NumPressed(7)"></td>   <td><input id="btn8" type="Button" value="  8  " onclick="NumPressed(8)"></td>         <td><input id="btn9" type="Button" value="  9  " onclick="NumPressed(9)"></td> <td colspan="2"><input id="btnC" type="Button" value="  C  " onclick="Clea

date-month-year validation in javascript

<script> function check() {    var dateCheck = /^(0?[1-9]|[12][0-9]|3[01])$/;    var monthCheck = /^(0[1-9]|1[0-2])$/;    var yearCheck = /^\d{4}$/;     var  a =document.myform.date.value; var  b=document.myform.month.value; var c=document.myform.year.value; if(a.match(dateCheck))   {     alert ("date is ok");   }     else   {   alert ("date is not ok");   }     if(b.match(monthCheck))   {     alert ("month is  ok");   }     else   {   alert ("month is not ok");   }     if(c.match(yearCheck))   {     alert ("year is  ok");   }     else   {   alert ("year is not ok");   } } </script > <form name=myform> Enter Date:<input type=text name=date> Enter Month:<input type=text name=month> Enter year<input type=text name=year> <INPUT name="Submit"  type="button" class="style2" onclick="javascript:check();" v

video tag

HTML  <video>  Tag: Description: The HTML <video> tag is used to embed video into your web page, it has several video sources. <!DOCTYPE html> <html> <body> <video width="320" height="240" controls>   <source src="movie.mp4" type="video/mp4">   <source src="movie.ogg" type="video/ogg">   Your browser does not support the video tag. </video> <p><strong>Note:</strong> The video tag is not supported in Internet Explorer 8 and earlier versions.</p> </body> </html> How to Llink    youtube    video   tag : <html> <head> <title> iframe tage youtube video example</title> </head> <body> <iframe width="560" height="315" src="https://www.youtube.com/embed/dUTmP3N1_AY" frameborder="0" allowfullscreen></ifra

HTML Attributes

HTML Attributes: All HTML elements can have   attributes Attributes provide   additional information   about an element Attributes are always specified in   the start tag Attributes usually come in name/value pairs like:   name="value" The title Attribute Here, a   title   attribute is added to the   <p>   element. The value of the title attribute will be displayed as a tooltip when you mouse over the paragraph: <!DOCTYPE html> <html> <body> <h2>The title attribute</h2> <p title="I'm a tooltip"> Mouse over this paragraph, to display the title attribute as a tooltip. </p> </body> </html> OUTPUT: The title attribute Mouse over this paragraph, to display the title attribute as a tooltip. The href Attribute HTML links are defined with the   <a>   tag. The link address is specified in the   href   attribute: <!DOCTYPE html> &l

style attribute for styling HTML elements

HTML   Styles : <!DOCTYPE html> <html> <body> <h2 style="color:red;">I am red</h2> <h2 style="color:blue;">I am blue</h2> </body> </html> Output: I am red I am blue The HTML Style Attribute Setting the style of an HTML element, can be done with the   style attribute . The HTML style attribute has the following   syntax : <tagname style=" property : value; "> The   property   is a CSS property. The   value   is a CSS value. You will learn more about CSS later in this tutorial. The   property   is a CSS property. The   value   is a CSS value. You will learn more about CSS later in this tutorial. <!DOCTYPE html> <html> <body style="background-color:powderblue;"> <h1>This is a heading</h1> <p>This is a paragraph.</p> </body> </html> Output: This is a heading This

html paragraph

<!DOCTYPE html> <html> <body> <p>This is a paragraph.</p> <p>This is a paragraph.</p> <p>This is a paragraph.</p> </body> </html> Output: This is a paragraph. This is a paragraph. This is a paragraph.

heading tags

<!DOCTYPE html> <html> <body> <h1>This is heading 1</h1> <h2>This is heading 2</h2> <h3>This is heading 3</h3> <h4>This is heading 4</h4> <h5>This is heading 5</h5> <h6>This is heading 6</h6> </body> </html> output: This is heading 1 This is heading 2 This is heading 3 This is heading 4 This is heading 5 This is heading 6

JavaScript

Client-Side JavaScript : Client-side JavaScript is the most common form of the language. The script should be included in or referenced by an HTML document for the code to be interpreted by the browser. It means that a web page need not be a static HTML, but can include programs that interact with the user, control the browser, and dynamically create HTML content. The JavaScript client-side mechanism provides many advantages over traditional CGI server-side scripts. For example, you might use JavaScript to check if the user has entered a valid e-mail address in a form field. The JavaScript code is executed when the user submits the form, and only if all the entries are valid, they would be submitted to the Web Server. JavaScript can be used to trap user-initiated events such as button clicks, link navigation, and other actions that the user initiates explicitly or implicitly. JavaScript can be implemented using JavaScript statements that are placed within the  <scrip