I'm storing the value of a specific form element as a variable. This same value is used in multiple functions.
function one() {
var selectedRole = $('#RegistrationRole_ID').val();
}
function two() {
var selectedRole = $('#RegistrationRole_ID').val();
}
I'd like to make this a global variable so I don't have to keep selecting i...
I have a rather unique situation here. I have a Silverlight application that captures images and uploads them to a web server which is pretty standard, but a requirement I have is to allow the web designer to make their own buttons and controls (or to style them) that controls the application.
So I decided to use ScriptableMember functi...
I have the following loading image:
<img id="loading" src="loading.gif" />
To show/hide it during an AJAX call, I have several solutions. For example, I can hide it by adding a class which corresponds to a CSS style:
$('#loading').addClass('hidden');
.hidden { display: none; }
Alternatively, I can use jQuery .show() and .hide(). I...
I'm writing a JS lib that reads chess games to turn them into re playable games, in one single web page there can be many games (one in its own div), what I'm wondering is – thinking about performance – if it's better to have one large object that holds all the moves of all the games or many smaller objects each storing the moves of one ...
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 of every variable the correct thing to do to keep it outside the global namespace?
Or would creating any var without declaring "var" first in my namespaced object, ensure of th...
I am getting an error when my app is being embedded in an iframe that reads
Permission denied for https://myapp.com to call method Location.toString on http://otherhost.com
I am not getting a stack trace, line number, or file where this occurring in any of the browsers. How could I figure out where this problem is coming from?
...
I can't get before & after callbacks to work with the cycle plugin for jQuery!
I'm not sure what's going wrong, i even tried using the sample code from the documentation.
Here's the code:
$(document).ready(function(){
function onBefore() { alert('before'); }
$('.slideshow').cycle({
before: 'onBefore'
});
});
a...
Within an ASP.NET AJAX UpdatePanel on my page I have a submit button which has some custom javascript validation applied which set a global _cancelGeneralSettingsUpdate flag depending on the results of the validation.
Everything works unless you enter an invalid value, correct it, and resubmit. In this case the variable _cancelGeneralS...
I have 3 node files:
// run.js
require('./configurations/modules');
require('./configurations/application');
// modules.js
var express = module.exports.express = require('express');
var app = module.exports.app = express.createServer();
// app.js
app.configure(...)
Run.js requires both files, modules.js which require a module and...
I need to create a web tool like Google Reader for my college project.
I have 2 question about it:
1) How Google Reader track the read and unread posts ?
2) Google Reader save every post in the db or load the feeds at the moment ?
...
What is your preference when it comes to editing/debugging large JavaScript projects, containing number of relatively big JS files?
Please list your choice, why do you like it compared to others; If it is already listed you can up vote it if you like.
...
Hi,
First of all, im new here, and im (not) a pro ;) (but i want to... lol). Okay, im starting a little php application to manage my icons (huge) collection... but i realise that i wrote everything in javascript (no jQuery) and my life would by a little more easier if i use jQuery... So now im trying to understand how to do that i i'll n...
I'm relatively new to Javascript, and I'd like to run the piece of code I spent the weekend playing with through JSLint so that it can point out where I was being a total idiot :)
Unfortunately, I get tons of errors about missing function declarations, which are part of the JQuery javascript library and various plugins for it.
Is there...
I want to invoke a javascript function, and I don't need a return value. The function is provided by a flash externalinterface, but I don't have access to allowing my domain access...
Can I proxy a javascript invocation? Do I have to send a cloned post, or is it possible to simply call the function?
I know YUI has callSWF, can I use th...
According to MDC https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/RegExp/exec the following code should log each of the global matches for this regexp.
var str = "(^|\\+)(1\\+1)($|\\+)";
var regex = new RegExp(str, "g");
var result;
var testString = "1+1+1";
while ((result = regex.exec(testString)) != null)
{
con...
Possible Duplicate:
Javascript callback programming?
A lot of jquery functions allow for a callback. Most are in a syntax like:
$('.selector').slideUp('fast', function(){
alert('slideUp has completed');
});
If I'm writing my own function, how can I make sure it is finished before the one after it is called (i.e. provide...
I have a function which is a JQuery event handler. Because it is a JQuery event handler, it uses the this variable to refer to the object on which it is invoked (as is normal for that library).
Unfortunately, I need to manually call that method at this point. How do I make this inside the called function behave as if it were called from...
hi, i have this code in javascript:
var object = {
get: function(id){
sel = document.getElementById(id);
sel.orig = {};
...
return object.extend(sel, object);
}
extend: function(el, opt){
for(var name in opt) el[name] = opt[name];
return el;
}
}
and in another js i hav...
I have a form with multiple fields, and each time the user changes a field the form is submitted (via hidden iframe), and the response is placed within an appropriate div on the page via a callback. The first time this works fine. But on each subsequent field change and submission, the response is shown in every div that has been filled ...
I have a javascript functions which returns a hash. I need to pass this hash to php to do stuff with it. Whats the best way to do that?
...