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

How do we get JavaScript onto a web page?
How do we get JavaScript onto a web page? You can use several different methods of placing JavaScript in you pages. You can directly add a script element inside the body of page. 1. For example, to add the "last updated line" to your pages, In your page text, add the following: &lt;p>blah, blah,...
2010-06-02, 4063👍, 0💬

How do you submit a form using Javascript?
How do you submit a form using Javascript? Use document.forms[0].submit(); (0 refers to the index of the form – if you have more than one form in a page, then the first one has the index 0, second has index 1 and so on).
2010-05-18, 4025👍, 0💬

What’s relationship between JavaScript and ECMAScript?
What’s relationship between JavaScript and ECMAScript? ECMAScript is yet another name for JavaScript (other names include LiveScript). The current JavaScript that you see supported in browsers is ECMAScript revision 3.
2010-05-18, 4361👍, 0💬

How is JavaScript different from Java?
How is JavaScript different from Java? JavaScript was developed by Brendan Eich of Netscape; Java was developed at Sun Microsystems. While the two languages share some common syntax, they were developed independently of each other and for different audiences. Java is a full-fledged programming langu...
2010-05-11, 3898👍, 0💬

What is JavaScript?
What is JavaScript? JavaScript is a platform-independent, event-driven, interpreted client-side scripting and programming language developed by Netscape Communications Corp. and Sun Microsystems. JavaScript is a general-purpose programming language designed to let programmers of all skill levels con...
2010-05-11, 4292👍, 0💬

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,...
2009-03-03, 4385👍, 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 ...
2009-03-03, 4197👍, 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."); }
2009-02-25, 4334👍, 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".
2009-02-25, 4233👍, 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 ...
2009-02-17, 4337👍, 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>
2009-02-17, 6321👍, 0💬

How to reload the current page
How to reload the current page window.location.reload(true);
2009-02-10, 4571👍, 0💬

How to set the cursor to wait?
How to set the cursor to wait? In theory, we should cache the current state of the cursor and then put it back to its original state. document.body.style.cursor = 'wait'; //do something interesting and time consuming document.body.style.cursor = 'auto';
2009-02-10, 4406👍, 0💬

How to make elements invisible?
How to make elements invisible? Change the "visibility" attribute of the style object associated with your element. Remember that a hidden element still takes up space, use "display" to make the space disappear as well. if ( x == y) { myElement.style.visibility = 'visible'; } else { myElement.style....
2009-02-03, 6731👍, 0💬

How to change style on an element?
How to change style on an element? Between CSS and javascript is a weird symmetry. CSS style rules are layed on top of the DOM. The CSS property names like "font-weight" are transliterated into "myElement.style.fontWeight". The class of an element can be swapped out. For example: document.getElement...
2009-02-03, 4161👍, 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...
2009-01-28, 4499👍, 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...
2009-01-28, 4896👍, 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 = ...
2009-01-20, 4202👍, 0💬

How to set a cookie with the contents of a textbox ?
How to set a cookie with the contents of a textbox ? Values stored in cookies may not have semicolons, commas, or spaces. You should use the handy "escape()" function to encode the values, and "unescape()" to retrieve them. //Sets cookie of current value for myTextBox function TextBoxOnchange() { va...
2009-01-20, 4768👍, 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");
2009-01-13, 4226👍, 0💬

How to create an input box?
How to create an input box? prompt("What is your temperature?");
2009-01-13, 4387👍, 0💬

How to create a confirmation box?
How to create a confirmation box? confirm("Do you really want to launch the missile?");
2009-01-06, 4341👍, 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.');
2009-01-06, 4537👍, 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>
2008-12-30, 4185👍, 0💬

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