Can someone tell me what exactly the two above lines of javascript do? And more importantly, what it's called so I can search some javascript references to learn about it? I ... |
I have a site that has an IE8-only problem:
The code is:
var w = window.open(urlstring, wname, wfeatures, 'false');
The error is:
Message: Invalid argument.
Line: 419
Char: ... |
I am building an object/property dump using JavaScript. This code breaks under Internet Explorer 8 (assuming subject = window.external)
// Gather the property names into the keys array.
var keys = Array(); for( ...
|
well what is needed is something like
var link = " http://www.google.com";
< a href= 'link' />
or something like it . so i need to use ... |
I tried the following in JavaScript (Firefox 3.5, Windows XP):
(function(){
window.foobar = 'Welcome!';
})();
var foobar = 'PWN3D!';
alert(foobar);
The output was 'PWN3D!'. Why did my code PWN me? I thought var ... |
I'm doing some experimenting with this malicious JavaScript line: var undefined = true;
Every uninitialized variable in JavaScript has the value of undefined which is just a variable that holds the special ... |
For instance, I am setting an interval like
timer = setInterval(fncName, 1000);
and if i go and do
clearInterval(timer);
it does clear the interval but is there a way to check that it cleared the ... |
|
is there a good solution how can i define more than one var with the same value in one step an the beginning of my funcion?
function myFunction (){
var ...
|
i have a little problem with Codemirror (http://codemirror.net/manual.html)
My code
$(document).ready(function ust()
{
pa_textareas();
});
...
|
I thought I understood the concept of the JavaScript prototype object, as well as [[proto]] until I saw a few posts regarding class inheritance.
Firstly, "JavaScript OOP - the smart way" at ... |
Title says it all. Why does
if (prev = this.Prev()) {
...
}
work but
if (var prev = this.Prev()) {
...
}
does not? this.Prev() is a method ... |
Seems like a simple problem, but can't get this to work.
In the example below, unselect is called but the public variable 'this.backSelected' is undefined. If I move the code of the ... |
what does the following code do in java script:
var x = x || {};
|
I am really confused as to why sometimes vars will not work when "var" is declared in front of them when used in a namespaced object. Isn't adding "var" in front ... |
I am trying to use the ExternalInterface.call function in my ActionScript(2.0) to get a javascript var value set in the wrapping document. The following seems to work in FireFox and in ... |
var a="1";
b={a:a},
the b variant isn't {"1":1},why will this happened?
also want to know if i want to get the result what i want ,how can i solve this problem
|
I just want to increase my core javascript knowledge.
Sometimes I see this statement but I don't know what it does:
var var1 = var1 || [];
What does it means and/or what's it ... |
Can someone explain what this does?
var foo = foo || alert(foo);
|
Sorry about the odd title... not sure how else to enquire about a language feature like this.
I was reading about module patterns when i came across this example when ... |
I was wondering what people thought of doing something like
var x = obj.child.prop1;
doSomething(x);
doOtherThings(x);
Doesn't var allocate more memory, rather than create a reference? Would it be worth it to avoid redefining x ... |
I have this:
var ivu = (total3);
document.getElementById("project_pay_total_field4").value = "$" + total3 * 0.07 ;
The multiplication produces this:
$10.080000000000002
--Its too long and when done in regular calculator it only says 10.08; ... |
I have a var that contains some text. I would like to check whether the texts has a certain word.
Example:
var myString = 'This is some random text';
I would like ... |
This is an oddity I've seen occasionally in JS - maybe someone can shed light on it.
I do a test for undefined on a variable:
if (x !== 'undefined'){}
or even
if (typeof x ...
|
Why doesn't an alert show in the below code?
var a = Array();
a[1] = "asd";
a[100] = "asdd";
alert(typeof a[50]);
if(typeof a[50] === 'undefinied') alert('und');
|
hi i am new with javascript
What is the benefit of using this line
var that = this
An example
function Person( firstname, lastname, age ) {
this.firstname = firstname;
this.lastname = lastname;
this.age = age;
getfullname = function() ...
|
hi i am new with javascript
What is the benefit of using this line
var that = this
An example
function Person( firstname, lastname, age ) {
this.firstname = firstname;
...
|
I'm cloning some table rows and would like to increment the IDs of its child nodes, I've tried doing this by:
var rowID = document.getElementById('RowTbl').rows.length / 2;
var NameRowCopy= document.getElementById('NameRow' + rowID).cloneNode(true);
...
|
Maybe pretty easy question.
Where should I use var keyword in JavaScript. It seems to me using it or not have the same effect ( but of course I'm still learning ... |
Not having much luck with this. I'm trying to determine if a var is not empty.
$('#content').mouseup(function() {
var selection = getSelected();
if ...
|
I found this javascript in a Facebook viral page here. I think the code is malicious so I would like to know what it does.
Here is the code:
javascript: var ...
|
At least in V8 something like
if((var i = x*x) == 2){}
will give an error about an unexpected 'var' keyword. However there is no error if the var happens before the if() ... |
Given:
console.log(boo); this outputs undefined
Given:
var boo = 1;
console.log(boo); this outputs 1
After defining boo and setting to 1, how can I then reset boo, so that console.log outputs undefined?
Thanks
|
Is there anything wrong with this test for undefined?
var undefined;
if(x == undefined){
//do something
}
or this:
function undefined(x){
return typeof x == 'undefined';
}
if(undefined(x)){
//do ...
|
My understanding it that with in a function if I use var then I have a local variable. If I do not delcare var I now have a global variable.
But ... |
Internet Explorer doesn't support the "const" keyword. Can I use a shim that checks if "const" is supported and, if not, redefines it as var? I guess it would be nice ... |
Here's the test: http://jsperf.com/forloopspeed
As you can see, the difference is huge in Firefox, present to a much lesser extent in Safari, and absent in Chrome and Opera.
The analogous ... |
Possible Duplicate:
Difference between using var and not using var in JavaScript
sometime, I saw people doing this
for(var i=0; i< array.length; i++){
//bababa
}
but I also see ... |
I just had a var I believed to be equal to "" or undefined. It turned out it was equal to \r. I couldn't see this until I wrapped the var ... |
I have a simple problem to solve, I know how to do it in PHP but have no ideia how to do it in javascript.
I gave a dinamic form, with N ... |
This is weird. Check this out:
for( var i = 0; i <= videos.length; i ++ ){
alert(videos[i].id); // this works and alerts the correct number
...
|
If I use distinct var statements like this:
function stretchDiv(){
var wh = $(window).height();
var sz2 = wh - ((paddingTop + paddingBottom) + (mainTop + ...
|
I've got either a literal object or one of it's components in var Z. Ie. one of the following
var Q = {"name" : 123};
Z = Q;
Z = Q["name"];
how can ... |
I have a script to change the text alignment for the textarea with the id textbox1 below:
// <![CDATA[
function alignFix() {
document.getElementById("textbox1").style.textAlign="left";
}
// ]]>
Here's the ... |
I read some where else that following is illegal
var 3po = true;
but
var highNoon = false;
is legal.
Could someone explain what is all this means? Why the first statement is illegal while ... |
seems like a simple question but I don't know JavaScript too well and my search-fu is turning up nothing relevant.
I need to set the backgroundColor property of a textbox to a ... |
Possible Duplicate:
Difference between using var and not using var in JavaScript
var foo = 1;
foo = 1;
What is the difference between above two lines ?
... |
I tried this:
var count;
function testCount ()
{
if (count)
{
alert("count is: " + count);
count++;
}
...
|
I'm studying apply and I am trying to understand why the code I am studying only passes one parameter to apply.
I first define Quo:
var Quo = function(string) {
...
|
I am getting an error: "document.getElementById("gender") is null" Any ideas how I can get this to work? Code: change var fruit to banana change var fruit to grape change var fruit to orange |