Friday, 31 August 2018

Clock Wise / Anti Clock Wise Stopwatch in JavaScript

:: Code ::

<html>
<head>
<title>stopwatch</title>
<script type="text/javascript">
var c=60;
var c2=0;
var t,t2;
function stopCount()
{
clearTimeout(t)
}
function stopCount2()
{
clearTimeout(t2)
}
function timedCount()
{
document.getElementById('txt').value=c
c=c-1
if(c==-1)
{
alert("time over")
stopcount()
}
t=setTimeout("timedCount()",1000)
}
function timedCount2()
{
document.getElementById('txt2').value=c2
c2=c2+1
if(c2==61)
{
alert("time over")
stopcount2()
}
t=setTimeout("timedCount2()",1000)
}
</script>
</head>
<body>
<center>
<form>
 <input type="text" id="txt">
 <input type="button" value="Start stopwatch (Anti Clock Wise)" onClick="timedCount()">
 <input type="button" value="Stop" onClick="stopCount()">
 <br/>
 <br/>
 <input type="text" id="txt2">
 <input type="button" value="Start stopwatch (Clock Wise)" onClick="timedCount2()">
 <input type="button" value="Stop" onClick="stopCount()">
</form>
<center>
</body>
</html>

:: Example ::




Monday, 19 March 2018

unable to open the physical file mdf operating system error access is denied

Solution:

Steps are given bellow:

  • go to Control Panel ->
  • System and Security ->
  • Administrative Tools ->
  • Services ->
  • Double Click SQL Server (SQLEXPRESS) -> right click, Properties
  • Select Log On Tab
  • Select "Local System Account" (the default was some obtuse Windows System account)
  • -> OK
  • right click, Stop
  • right click, Start
Now you want to try attach your .mdf file.

Friday, 4 August 2017

Delete HTML Table Row Using Javascript/JQuery Without RowIndex

Using JavaScript:

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

<p>Click the button to delete the any row from the table.</p>

<table id="table1">
  <tr id="myRow1">
    <td>First cell</td>
    <td>Second cell</td>
    <td>Third cell</td>
    <td><input type="button" onclick="deleteRow('myRow1')" value="Delete"/></td>
  </tr>
  <tr id="myRow2">
    <td>First cell</td>
    <td>Second cell</td>
    <td>Third cell</td>
    <td><input type="button" onclick="deleteRow('myRow2')" value="Delete"/></td>
  </tr>
  <tr id="myRow3">
    <td>First cell</td>
    <td>Second cell</td>
    <td>Third cell</td>
    <td><input type="button" onclick="deleteRow('myRow3')" value="Delete"/></td>
  </tr>
</table><br>

<script>
function deleteRow(myRow) {
    var row = document.getElementById(myRow);
    var total_cell=document.getElementById('table1').rows[0].cells.length;

   for(i=0;i<total_cell;i++)
   {
    row.deleteCell(0);
    }
  
}

</script>

</body>
</html>


Using JQuery:


<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<style>
table, td {
    border: 1px solid black;
}
</style>
</head>
<body>
<table id="table1">
  <tr id="myRow1">
    <td>First cell</td>
    <td>Second cell</td>
    <td>Third cell</td>
    <td><input type="button" onclick="deleteRow(this)" value="Delete"/></td>
  </tr>
  <tr id="myRow2">
    <td>First cell</td>
    <td>Second cell</td>
    <td>Third cell</td>
    <td><input type="button" onclick="deleteRow(this)" value="Delete"/></td>
  </tr>
  <tr id="myRow3">
    <td>First cell</td>
    <td>Second cell</td>
    <td>Third cell</td>
    <td><input type="button" onclick="deleteRow(this)" value="Delete"/></td>
  </tr>
</table><br>



<script>
function deleteRow(this_row) {
    $(this_row).closest("tr").html("");
  
}
</script>

</body>
</html>

Thursday, 22 September 2016

How to bind Dropdown Test and Value Dynamically and Retrive also?


<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script>
function DynamicBind()
{
var Ttext="India";//CountryName -> this is visible
var Tvalue="CId-1";//CountryId -> this is invisible for secure back hand code

$("#textandvalueSET").append($('<option></option>').val("").html("-Select-"));
$("#textandvalueSET").append($('<option></option>').val(Tvalue).html(Ttext));

}

function ShowDropTextValue()
{
var countrySelect = document.getElementById("textandvalueSET");
var selectedText = countrySelect.options[countrySelect.selectedIndex].text;
alert(" Selected Text: "+selectedText);

var vv=document.getElementById("textandvalueSET").value;
alert(" Selected Value= "+vv);

}
</script>
</head>
<body>

<br/>
<br/>
<input type="button" value="Dynamic" onclick="DynamicBind()"/>
<select id="textandvalueSET" onchange="ShowDropTextValue()">

</select>
</body>
</html>

Wednesday, 22 June 2016

Show/Hide Image in Javascript with fileupload

<html>
<head>
<script>
  var loadFile = function(event) {
var img = document.getElementById('output');
    img.style.visibility = 'visible';
    var output = document.getElementById('output');
    output.src = URL.createObjectURL(event.target.files[0]);
  };
function resetimg()
{
var img = document.getElementById('output');
    img.style.visibility = 'hidden';

}
</script>
</head>
<body onload="resetimg()">
<form name="f1">
<input type="file" accept="image/*" onchange="loadFile(event)">

<img id="output" width="100px" height="150px"/>

<br/>
<input type="reset" value="Clear" onclick="resetimg()"/>
</form>
</body>

Tuesday, 21 June 2016

Preview an Image when browse using Javascript

<html>
<head>
<script>
  var loadFile = function(event) {
    var output = document.getElementById('output');
    output.src = URL.createObjectURL(event.target.files[0]);
  };
</script>
</head>
<body>

<input type="file" accept="image/*" onchange="loadFile(event)">
<img id="output" width="100px" height="150px"/>
</body>

Sunday, 31 January 2016

Checkbox is checked and unchecked corresponding button disabled and enabled using javascript

<html>
<body>
<script LANGUAGE="JavaScript">

function ValidateForm()
{
   if ( document.form1.terms.checked == false )
     {
      
       
   document.getElementById("ss").disabled=true;
     }
   else
    {
      document.getElementById("ss").disabled=false;
     
    }
}

</script>
<br/><form name="form1">
<input type="checkbox" id="terms" value="Yes" onclick="ValidateForm()"/>
I accept Terms & Conditions:
<br/><br/>
<input type="button" name="SubmitButton" id="ss" disabled="disabled" value="Submit">

</form>
</body>
</html>


Output-1:









Output-2: