Posts

How to get value of selected radio button using JavaScript ?

How to get value of selected radio button using JavaScript ? To get the vale of selected radio button,create a function that  function gets all the radio button using with the Name attribute and finds the radio button selected using checked property.The checked property  return true or false.If radio button is checked it returns true otherwise it returns false. If we use multiple radio button than each button has its own index value therefore we access  selected radio button using this index value.  After get value we display result in a box using innerHTML.  FOR EXAMPLE  THE FOLLOWING PROGRAM DISPLAY THE SELECTED RADIO BUTTON VALUE <html>     <body>         <input type= "radio" name= "gender" value= "male" >Male          <input type= "radio" name= "gender" value= "Female" >Female           <input type= "radio" n...

javaScript Calculator.

Image
javaScript Calculator. calculator using HTML,CSS and javaScrip t. Html code- <html>     <head>         <meta charset="utf-8">         <meta name="viewport" content="width=device-width, initial-scale=1.0">         <link rel="stylesheet" type="text/css" href="style_calculater.css">         <script src="script_src.js">     </head>     <body>     <div class="container">         <div class="dbox"><input type="text" id="display" placeholder="0"><br>         <input type="text" id="display2" placeholder="0">         <div id="box">             <button class="key" value="7" onclick="dis('7')" > 7 </button>              <butt...

Svg_house

Image
Create a simple House through using HTML(SVG) In this house we use only polygon SVG and line for create this house. Code:- <svg height="350" width="600"> <polygon fill= "#eb593d" points= "100,200 0,300 0,350 600,350 600,300 400,200" staroke-width= "4" stroke= "red" ></polygon>   <polygon points= "150,25 400,25 500,120 250,125" fill= "brown" stroke= "red" staroke-width= "4" /> <polygon points= "150,25 250,125 50,85" fill= "gold" stroke= "red" staroke-width= "4" /> <polygon points= "235,123 75,90 75,240 235,275" fill= "green" stroke= "red" staroke-width= "4" /> <polygon points= " 235,275 485,270 485,245 235,250" fill="brown" stroke= "red" staroke-width= "4" /> <polygon points= "485...

What is SVG

Image
What is SVG ? * SVG stands for  Scalable Vector Graphics, that is used to define graphics for web page. * This concept is achieved with the help of <svg> tag that is container for SVG graphics,   in SVG several method for create path, line,box, circle, triangle, rectangel and graphics images. SVG rectangle- Example- < svg  width ="400"  height ="100" > < rect  width ="400"  height ="100"  fill ="green" stroke ="red" stroke-width ="3"  / > < /svg > SVG square- Example- < svg  width ="100"  height ="100" > < rect  width ="100"  height ="100"  fill ="yellow"  stroke ="red"  stroke-width ="3"  / > < /svg > SVG  Circle- Example- < svg  width ="100"  height ="100" > < circle  cx ="50"  cy ="50"  r ="40"  stroke =...

Bubble sort

Image
Sorting Sorting is a process in which we arrange the data of  any list in any particular order  such as ascending order and descending order.

Searching

Image
Searching Searching is a operation in which any particular data is search in the list.The search is said to be successful or unsuccessful depending on whether searching is found or not. there are two  method to search element- linear search and Binary search. Linear search This is simple method of searching. In this method,the element is searched in sequence order as one by one.This method can applied on sorted or an unsorted list 10 30 50 60 20 40 80 70 100 90 The array shown in figure consist 10 number.Suppose  the element 60 is searched, so 60 is compared with starting with 0th position and searching process is ends either when 60 is found or the list ends. The number of comparisons in linear searching is 0(n). void linear_searching( int a[], int size,int svalue) {     int i, flag=0;     for(i=0;i<size;i++)     {         if(a[i]==svalue) ...

digital clock

Image
The date object is a built-in JavaScript object that enables you to conveniently work with date and times.You can create a date object anytime you need to store a date.Date object is  created using new keyword. birthday= new Date(); birthday= new Date("june 20,2002 08:00:00"); birthday=new Date("6,20,2002");   Setting Date values. setDate()   set the date of month; setMonth()  set the month, month number is 0 to 11; setFullYear()  set full year. setTime()   set the  time. setHours(),setMinutes(),setSeconds()   set the time. Getting date values. getDate()   get the date of month; getMonth()  get the month, month number is 0 to 11; getFullYear()  get full year. getTime()   get the  time. getHours(),getMinutes(),getSeconds()   get the time. <html>     <head>     <style>         #circle   ...