< 1 2 3 4 5 6 7 > >>   Sort: Rank

What's the Date object using JavaScript?
What's the Date object using JavaScript? Time inside a date object is stored as milliseconds since Jan 1, 1970. new Date(06,01,02) // produces "Fri Feb 02 1906 00:00:00 GMT-0600 (Central Standard Time)" new Date(06,01,02).toLocaleString( )// produces "Friday, February 02, 1906 00:00:00" new Date(06,...
2011-07-05, 3465👍, 0💬

What's Math Constants and Functions using JavaScript?
What's Math Constants and Functions using JavaScript? The Math object contains useful constants such as Math.PI, Math.E Math also has a zillion helpful functions. Math.abs(value); //absolute value Math.max(value1, value2); //find the largest Math.random() //generate a decimal number between 0 and 1 ...
2011-07-05, 3278👍, 0💬

How to test for bad numbers using JavaScript?
How to test for bad numbers using JavaScript? The global method, "isNaN()" can tell if a number has gone bad. var temperature = parseFloat(myTemperatureWidget .value);if(!isNaN(temperature)) { alert("Please enter a valid temperature."); }
2011-06-28, 3318👍, 0💬

How to convert numbers to strings using JavaScript?
How to convert numbers to strings using JavaScript? You can prepend the number with an empty string var mystring = ""+myinteger; or var mystring = myinteger.toString(); You can specify a base for the conversion, var myinteger = 14; var mystring = myinteger.toString(16); mystring will be "e".
2011-06-21, 3418👍, 0💬

How to convert a string to a number using JavaScript?
How to convert a string to a number using JavaScript? You can use the parseInt() and parseFloat() methods. Notice that extra letters following a valid number are ignored, which is kinda wierd but convenient at times. parseInt("100") ==&gt; 100 parseFloat("98.6") ==&gt; 98.6 parseFloat("98.6 ...
2011-06-21, 3424👍, 0💬

How to force a page to go to another page using JavaScript?
How to force a page to go to another page using JavaScript? &lt;script language="JavaScript" type="text/javascript" >&lt;!-- location.href="http://newhost/ newpath/newfile.html";//-->&lt;/script>
2011-06-14, 3170👍, 0💬

How to remove the event listener?
How to remove the event listener? &lt;script type="text/javascript">&lt ;!--document.getElementById("hitme 4").removeEventListener("click ",hitme4, false); // --&gt; &lt;/script> Key Events "onkeydown", "onkeypress", "onkeyup" events are supported both in ie and standards-based browse...
2011-05-31, 3465👍, 0💬

How to Add Event Handlers?
How to Add Event Handlers? You can add an event handler in the HTML definition of the element like this: &lt;script type="text/javascript">&lt ;!--function hitme() { alert("I've been hit!"); } // --&gt; &lt;/script> &lt;input type="button" id="hitme" name="hitme" value="hit me" o...
2011-05-24, 3707👍, 0💬

How to get values from cookies to set widgets?
How to get values from cookies to set widgets? function getCookieData(labelName) { //from Danny Goodman var labelLen = labelName.length; // read cookie property only once for speed var cookieData = document.cookie; var cLen = cookieData.length; var i = 0; var cEnd; while (i &lt; cLen) { var j = ...
2011-05-24, 3530👍, 0💬

How to open a window with no toolbar, but with the location object.
How to open a window with no toolbar, but with the location object. window.open("http://www.mysite .org/Misc/Pennies","Pennies"," resizable=yes,status=yes,toolbar=yes,locatio n=yes,menubar=yes,scrollbars=y es,width=800,height=400");
2011-05-15, 3256👍, 0💬

How to create an input box?
How to create an input box? prompt("What is your temperature?");
2011-03-08, 3659👍, 0💬

How to create a confirmation box?
How to create a confirmation box? confirm("Do you really want to launch the missile?");
2011-03-08, 3596👍, 0💬

How to create a popup warning box?
How to create a popup warning box? alert('Warning: Please enter an integer between 0 and 100.');
2011-03-01, 3262👍, 0💬

How to have the status line update when the mouse goes over a link?
How to have the status line update when the mouse goes over a link? &lt;a href="javascript.shtml" onmouseover="window.status='Hi There!';return true" onmouseout="window.status='';r eturntrue">Look at the Status bar&lt;/a> Look at the Status bar as your cursor goes over the link.
2011-03-01, 3482👍, 0💬

How to have an element invoke a JavaScript on selection, instead of going to a new URL:
How to have an element invoke a JavaScript on selection, instead of going to a new URL: &lt;script type="text/javascript"> function pseudoHitMe() { alert("Ouch!"); } &lt;/script> &lt;a href="javascript:pseudoHitMe() ">hitme&lt;/a>
2011-02-22, 3389👍, 0💬

How to add new elements dynamically.
How to add new elements dynamically. &lt;html xmlns="http://www.w3.org/1999/ xhtml"xml:lang="en" lang="en"> &lt;head> &lt;title>t1&lt;/title >&lt;script type="text/javascript"> function addNode() { var newP = document.createElement("p"); var textNode = document.createTextNode(" I...
2011-02-22, 3464👍, 0💬

How to write messages to the screen without using "document.write()"?
How to write messages to the screen without using "document.write()"? Changing the contents of an element is a much better solution. When the method showStatus is invoked, it will change the content of the span. ... function showStatus(message) { var element = document.getElementById("mysta tus");el...
2011-02-15, 4167👍, 0💬

How to disable an HTML object
How to disable an HTML object document.getElementById("myObj ect").disabled= true;
2011-02-15, 3810👍, 0💬

How to find radio button selection when a form is submitted?
How to find radio button selection when a form is submitted? &lt;script type="text/javascript"> function findButton() { var myForm = document.forms.animalForm; var i; for (i=0;i&lt;myForm.marsupial .length;i++) { if (myForm.marsupial[i].checked) { break; } } alert("You selected \""+myForm.ma...
2011-02-08, 3762👍, 0💬

How to find the selected radio button immediately using the 'this' variable?
How to find the selected radio button immediately using the 'this' variable? &lt;script> function favAnimal(button) { alert('You like '+button.value+'s.'); } &lt;/script> &lt;input type="radio" name="marsupial" value="kangaroo" onchange="favAnimal(this)">Kan garoo&lt;br />&lt;inp...
2011-02-08, 3422👍, 0💬

What is === operator?
What is === operator? ==== is strict equality operator, it returns true only when the two operands are having the same value without any type conversion.
2011-02-01, 3528👍, 0💬

What are undefined and undeclared variables?
What are undefined and undeclared variables? Undeclared variables are those that are not declared in the program (do not exist at all), trying to read their values gives runtime error. But if undeclared variables are assigned then implicit declaration is done . Undefined variables are those that are...
2011-02-01, 3386👍, 0💬

Does JavaScript have the concept level scope?
Does JavaScript have the concept level scope? No. JavaScript does not have block level scope, all the variables declared inside a function possess the same level of scope unlike c, c++, and java.
2011-01-25, 3958👍, 0💬

What is variable typing in JavaScript?
What is variable typing in JavaScript? It is perfectly legal to assign a number to a variable and then assign a string to the same variable as in the following example: i = 10; i = "string"; This is called variable typing
2011-01-25, 3255👍, 0💬

< 1 2 3 4 5 6 7 > >>   Sort: Rank