---
var array = [0, 1, null, 2, "", 3, undefined, 3,,,,,, 4,, 4,, 5,, 6,,,,];
var filtered = array.filter(function (el) {
return el != null;
});
console.log(filtered);
__________________________
Click on interval
setInterval(function () {document.getElementById("checkin_submit").click();}, 6000);
___________________________________________________
###Password Hide and show
feild-----
<input id="register_password" class="form-control" type="password" name="password" placeholder="Password" required><i class="glyphicon glyphicon-eye-open eyemark" onclick="Toggle()" value="Show" ></i>
Script----
$(".glyphicon-eye-open").on("click", function() {
$(this).toggleClass("glyphicon-eye-close");
var type = $("#login_password").attr("type");
var type2 = $("#register_password").attr("type");
if (type == "text"){
$("#login_password").prop('type','password');}
else{
$("#login_password").prop('type','text'); }
if (type2 == "text"){
$("#register_password").prop('type','password');}
else{
$("#register_password").prop('type','text'); }
});
_________________________________________________________________
<script>
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1;
var yyyy = today.getFullYear();
if(dd<10)
{
dd='0'+dd;
}
if(mm<10)
{
mm='0'+mm;
}
today = mm+'/'+dd+'/'+yyyy;
console.log(today);
----
var date = new Date();
var hours = date.getHours();
var minutes = date.getMinutes();
var ampm = hours >= 12 ? 'PM' : 'AM';
hours = hours % 12;
hours = hours ? hours : 12; // the hour '0' should be '12'
minutes = minutes < 10 ? '0'+minutes : minutes;
var strTime = hours + ':' + minutes + ' ' + ampm;
document.write(strTime);
</script>
----------------------
<!-- <script>
if (jQuery) {
alert("jQuery library is loaded!");
} else {
alert("jQuery library is not found!");
}
</script> -->
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript getFullYear()</h2>
<p>The getFullYear() method returns the full year of a date:</p>
<p id="demo"></p>
<script>
var d = new Date();
var newdate = d.getFullYear()+'/'+d.getMonth()+'/'+d.getDate();
document.getElementById("demo").innerHTML = newdate;
</script>
</body>
</html
---------------------------------------------------------------
<!DOCTYPE html>
<html>
<style>
#myProgress {
position: relative;
width: 100%;
height: 30px;
background-color: #ddd;
}
#myBar {
position: absolute;
width: 10%;
height: 100%;
background-color: #4CAF50;
}
#label {
text-align: center;
line-height: 30px;
color: white;
}
</style>
<body>
<h1>JavaScript Progress Bar</h1>
<div id="myProgress">
<div id="myBar">
<div id="label">10%</div>
</div>
</div>
<br>
<button onclick="move()">Click Me</button>
<script>
function move() {
var elem = document.getElementById("myBar");
var width = 10;
var id = setInterval(frame, 38);
function frame() {
if (width >= 100) {
clearInterval(id);
} else {
width++;
elem.style.width = width + '%';
document.getElementById("label").innerHTML = width * 1 + '%';
}
}
}
</script>
</body>
</html>
_______________________________________________________
_______________________________________________________
var array = [0, 1, null, 2, "", 3, undefined, 3,,,,,, 4,, 4,, 5,, 6,,,,];
var filtered = array.filter(function (el) {
return el != null;
});
console.log(filtered);
__________________________
Click on interval
setInterval(function () {document.getElementById("checkin_submit").click();}, 6000);
___________________________________________________
###Password Hide and show
feild-----
<input id="register_password" class="form-control" type="password" name="password" placeholder="Password" required><i class="glyphicon glyphicon-eye-open eyemark" onclick="Toggle()" value="Show" ></i>
Script----
$(".glyphicon-eye-open").on("click", function() {
$(this).toggleClass("glyphicon-eye-close");
var type = $("#login_password").attr("type");
var type2 = $("#register_password").attr("type");
if (type == "text"){
$("#login_password").prop('type','password');}
else{
$("#login_password").prop('type','text'); }
if (type2 == "text"){
$("#register_password").prop('type','password');}
else{
$("#register_password").prop('type','text'); }
});
_________________________________________________________________
<script>
var today = new Date();
var dd = today.getDate();
var mm = today.getMonth()+1;
var yyyy = today.getFullYear();
if(dd<10)
{
dd='0'+dd;
}
if(mm<10)
{
mm='0'+mm;
}
today = mm+'/'+dd+'/'+yyyy;
console.log(today);
----
var date = new Date();
var hours = date.getHours();
var minutes = date.getMinutes();
var ampm = hours >= 12 ? 'PM' : 'AM';
hours = hours % 12;
hours = hours ? hours : 12; // the hour '0' should be '12'
minutes = minutes < 10 ? '0'+minutes : minutes;
var strTime = hours + ':' + minutes + ' ' + ampm;
document.write(strTime);
</script>
----------------------
<!-- <script>
if (jQuery) {
alert("jQuery library is loaded!");
} else {
alert("jQuery library is not found!");
}
</script> -->
_____________________________________________
<!DOCTYPE html>
<html>
<body>
<h2>JavaScript getFullYear()</h2>
<p>The getFullYear() method returns the full year of a date:</p>
<p id="demo"></p>
<script>
var d = new Date();
var newdate = d.getFullYear()+'/'+d.getMonth()+'/'+d.getDate();
document.getElementById("demo").innerHTML = newdate;
</script>
</body>
</html
<!DOCTYPE html>
<html>
<style>
#myProgress {
position: relative;
width: 100%;
height: 30px;
background-color: #ddd;
}
#myBar {
position: absolute;
width: 10%;
height: 100%;
background-color: #4CAF50;
}
#label {
text-align: center;
line-height: 30px;
color: white;
}
</style>
<body>
<h1>JavaScript Progress Bar</h1>
<div id="myProgress">
<div id="myBar">
<div id="label">10%</div>
</div>
</div>
<br>
<button onclick="move()">Click Me</button>
<script>
function move() {
var elem = document.getElementById("myBar");
var width = 10;
var id = setInterval(frame, 38);
function frame() {
if (width >= 100) {
clearInterval(id);
} else {
width++;
elem.style.width = width + '%';
document.getElementById("label").innerHTML = width * 1 + '%';
}
}
}
</script>
</body>
</html>
_______________________________________________________
## ROUND FLOAT VALUE UPTO n PLACES value.toFixed(n); ## The splice() method adds/removes items to/from an array, and returns the removed item(s). <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> var fruits = ["Banana", "Orange", "Apple", "Mango"]; document.getElementById("demo").innerHTML = fruits; function myFunction() { fruits.splice(1, 2,"vinay"); document.getElementById("demo").innerHTML = fruits; } </script>
Comments
Post a Comment