Posts

Showing posts from October, 2017

phone no validation

< form > Phone Number (format: xxx-xxx-xxxx): < input type = "tel" pattern = "^\d {3} -\d {3} -\d {4} $" required > < input type = "submit" value = "Submit" > </ form > < form > Phone Number (format: xxxxxxxxxx): < input type = "tel" pattern = "^\d {10} $" required > < input type = "submit" value = "Submit" > </ form >

Javascript onkeyup

<html>     <head>         <script>             function add()             {                 var a = parseInt(document.getElementById("t1").value);                 var b = parseInt(document.getElementById("t2").value);                 var result = a + b;                 document.getElementById("s1").innerHTML = result;             }         </script>         <title>Addition Using Ajax</title>     </head>     <body>         <h1>Addition Using Ajax </h1>         <table border="0" cellpadding="10px">             <tr>                 <td>Enter First Number</td>                 <td>                     <input type="text" id="t1" onKeyUp="add()">                 </td>             </tr>             <tr>                 <td>Enter Second Number</td>                 <td>                 

Display records from database using pie chart

<?php $con=mysqli_connect('localhost','root','root','pie_chart') or die(mysqli_connect_error());    $query=mysqli_query($con,"select * from visitors") or die(mysqli_error($con));  ?> <html>   <head>     <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>     <script type="text/javascript">       google.charts.load('current', {'packages':['corechart']});       google.charts.setOnLoadCallback(drawChart);       function drawChart() {         var data = google.visualization.arrayToDataTable([           ['country', 'Visits'],           <?php           while ($row=mysqli_fetch_assoc($query)) {                             echo "['".$row['country']."',".$row['vis']."],";           }            ?>         ]);         var o