We can easy to extract the timezone from current system time using javascript by the following code.
Example Program:- (Editor)

Editor is Loading...
Advertisement
Example Program:- (Editor)
Editor is Loading...
Advertisement
04:05
Muhammad Kaif
var img = document.createElement("img");
img.src = "http://www.google.com/intl/en_com/images/logo_plain.png";
var src = document.getElementById("elementid");
src.appendChild(img);
23:56
Muhammad Kaif
function listboxMove(listID, direction) {
var listbox = document.getElementById(listID);
var selIndex = listbox.selectedIndex;
if (-1 == selIndex) {
alert("Please select an option to move.");
return;
}
var increment = -1;
if (direction == 'up')
increment = -1;
else
increment = 1;
if ((selIndex + increment) < 0 ||
(selIndex + increment) > (listbox.options.length - 1)) {
return;
}
var selValue = listbox.options[selIndex].value;
var selText = listbox.options[selIndex].text;
listbox.options[selIndex].value = listbox.options[selIndex + increment].value
listbox.options[selIndex].text = listbox.options[selIndex + increment].text
listbox.options[selIndex + increment].value = selValue;
listbox.options[selIndex + increment].text = selText;
listbox.selectedIndex = selIndex + increment;
}
23:29
Muhammad Kaif
function listboxSelectDeselect(listID, isSelect) {
var listbox = document.getElementById(listID);
for (var count = 0; count < listbox.options.length; count++) {
listbox.options[count].selected = isSelect;
}
}
23:03
Muhammad Kaif
window.onbeforeunload = function() {
return "Are you sure to go back?";
};
00:17
Muhammad Kaif
navigator.userAgentYou can find is this is mobile device or not using the following code
/(ipad|iphone|ipod|android|windows phone)/i.test(navigator.userAgent)Mostly we need to check it for cordova mobile application, because we need to check it in desktop pc or in normal browser and mobile native application, in that situation we can check like below.
if(( /(ipad|iphone|ipod|android|windows phone)/i.test(navigator.userAgent) ))
{
cordova.plugins.Keyboard.close();
}
11:45
Muhammad Kaif
11:23
Muhammad Kaif
variable.toString() //convert to String
variable.toString(2) //convert to Binary
variable.toString(8) //convert to Octal
variable.toString(16) //convert to Hexadecimal
var num=66;
num.toString(); //return "66"
num.toString(2); //return "1000010"
num.toString(8); //return "102"
num.toString(16); //return "42"
12:18
Muhammad Kaif
parseInt(string, radix);
parseInt(" 0xF", 16);
parseInt(" F", 16);
parseInt("17", 8);
parseInt(021, 8);
parseInt("015", 10);
parseInt(15.99, 10);
parseInt("15,123", 10);
parseInt("FXX123", 16);
parseInt("1111", 2);
parseInt("15*3", 10);
parseInt("15e2", 10);
parseInt("15px", 10);
parseInt("12", 13);
parseInt("Hello", 8); // Not a number at all
parseInt("546", 2); // Digits are not valid for binary representations
parseInt("-F", 16);
parseInt("-0F", 16);
parseInt("-0XF", 16);
parseInt(-15.1, 10);
parseInt(" -17", 8);
parseInt(" -15", 10);
parseInt("-1111", 2);
parseInt("-15e1", 10);
parseInt("-12", 13);
parseInt("0e0", 16);
12:00
Muhammad Kaif
parseFloat(string);
parseFloat("3.14");
parseFloat("314e-2");
parseFloat("0.0314E+2");
parseFloat("3.14more non-digit characters");
RSS Feed
Twitter