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

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, 4108👍, 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, 4432👍, 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, 4826👍, 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, 4137👍, 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, 4641👍, 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, 4149👍, 0💬

How to create an input box?
How to create an input box? prompt("What is your temperature?");
2009-01-13, 4326👍, 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, 4263👍, 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, 4460👍, 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, 4115👍, 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.
2008-12-30, 4272👍, 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...
2008-12-23, 4207👍, 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...
2008-12-23, 4400👍, 0💬

How to disable an HTML object
How to disable an HTML object document.getElementById("myObj ect").disabled= true;
2008-12-16, 4154👍, 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...
2008-12-16, 4193👍, 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...
2008-12-09, 4132👍, 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.
2008-12-09, 4266👍, 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...
2008-12-02, 4285👍, 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.
2008-12-02, 4205👍, 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
2008-11-25, 4364👍, 0💬

What is the difference between undefined value and null value?
What is the difference between undefined value and null value? Undefined value cannot be explicitly stated that is there is no keyword called undefined whereas null value has keyword called null. typeof undefined variable or property returns undefined whereas typeof null value returns object
2008-11-25, 4205👍, 0💬

What does undefined value mean in JavaScript?
What does undefined value mean in JavaScript? Undefined value means the variable used in the code doesn't exist or is not assigned any value, or the property doesnt exist.
2008-11-18, 4570👍, 0💬

How to select an element by id and swapping an image?
How to select an element by id and swapping an image? ... &lt;script language="JavaScript" type="text/javascript" > function setBeerIcon() { var beerIcon = document.getElementById("beerI con");beerIcon.src = "images/"+getSelectValue("beer ")+".jpg";} &lt;/script> ... &lt;img border="0" s...
2008-11-18, 4430👍, 0💬

To set all checkboxes to true using JavaScript?
To set all checkboxes to true using JavaScript? //select all input tags function SelectAll() { var checkboxes = document.getElementsByTagName( "input");for(i=0;i&lt;checkboxes.le ngth;i++){ if(checkboxes.item(i).attribut es["type"].value== "checkbox") { checkboxes.item(i).checked = true; } } }
2008-11-11, 4375👍, 0💬

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