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

How to associate functions with objects using JavaScript?
How to associate functions with objects using JavaScript? Let's now create a custom "toString()" method for our movie object. We can embed the function directly in the object like this. &lt;script type="text/javascript"> function movie(title, director) { this.title = title; this.director = direc...
2011-08-09, 4484👍, 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, 4477👍, 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, 4474👍, 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, 4467👍, 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, 4466👍, 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, 4460👍, 0💬

How to disable an HTML object
How to disable an HTML object document.getElementById("myObj ect").disabled= true;
2008-12-16, 4442👍, 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, 4438👍, 0💬

What is the difference between RegisterClientScriptBlock and RegisterStartupScript?
What is the difference between RegisterClientScriptBlock and RegisterStartupScript? RegisterClientScriptBlock emits the JavaScript just after the opening &lt;form> tag. RegisterStartupScript emits the JavaScript at the bottom of the ASP.NET page just before the closing &lt;/form> tag.
2010-10-05, 4437👍, 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, 4425👍, 0💬

What is the difference unescape() and escape()?
What is the difference unescape() and escape()? These are similar to the decodeURI() and encodeURI(), but escape() is used for only portions of a URI: &lt;script type="text/javascript"> var myvalue = "Sir Walter Scott"; document.write("Original myvalue: "+myvalue); document.write("&lt;br />e...
2011-08-23, 4412👍, 0💬

Name the numeric constants representing max, min values
Name the numeric constants representing max, min values Number.MAX_VALUE Number.MIN_VALUE
2008-10-14, 4410👍, 0💬

What does the "Access is Denied" IE error mean?
What does the "Access is Denied" IE error mean? The "Access Denied" error in any browser is due to the following reason. A JavaScript in one window or frame is tries to access another window or frame whose document's domain is different from the document containing the script.
2010-08-31, 4399👍, 0💬

What are JavaScript data types?
What are JavaScript data types? Number, String, Boolean, Function, Object, Null, Undefined.
2010-06-15, 4397👍, 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, 4391👍, 0💬

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, 4370👍, 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, 4365👍, 0💬

How to get the contents of an input box using JavaScript?
How to get the contents of an input box using JavaScript? Use the "value" property of the input box object. For example: var myValue = window.document.getElementById ("MyTextBox").value;
2010-10-12, 4348👍, 0💬

The join() function allows you to:
The join() function allows you to: A) create a string out of an array. B) create an array out of a string delimited by some character. C) join two strings. D) all of the above.
2010-08-28, 4342👍, 0💬

nodeList is almost like an array except:
nodeList is almost like an array except: A) it has an item method. B) it is read-only. C) both a and b above. D) none of the above.
2010-08-28, 4272👍, 0💬

What looping structures are there in JavaScript?
What looping structures are there in JavaScript? for, while, do-while loops, but no foreach.
2010-11-30, 4263👍, 0💬

What is negative infinity?
What is negative infinity? It’s a number in JavaScript, derived by dividing negative number by zero.
2010-08-10, 4254👍, 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, 4248👍, 0💬

What does "1"+2+4 evaluate to?
What does "1"+2+4 evaluate to? Since "1" is a string, everything is a string, so the result is a string of "124".
2010-09-28, 4188👍, 0💬

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