Given some JS code like that one here:
for (var i = 0; i < document.getElementsByName('scale_select').length; i++) {
document.getElementsByName('scale_select')[i].onclick = vSetScale;
}
Would the code be faster ... |
I have a JavaScript variable which contains the name of a JavaScript function. This function exists on the page by having been loaded in and placed using $.ajax, etc.
Can anyone tell ... |
Here is the module i am working on:
var FeatureRotator = (function($,global) {
var self = {},
currentFeature = 0,
...
|
I have a variable that is the functions name. I want to be able to call on that function from the variable.
var CircuitBox= document.getElementById("QLCS")
var CircuitNumber = CircuitBox.selectedIndex;
var circuit = CircuitBox.options[CircuitNumber].value;
// This ...
|
The problem is next:
Assume that we have a select.
Onchange event we need to call some function, but name of this function kept in variable.
How to call this function ?
|
I have a really long winded switch case statement like this
switch(x){
case "a":
// call function a
a():
...
|
Why is it that I have to use a new instance of a function in order to get an inner variable, but I can't use the function itself,
why this works
function bla(){this.a ...
|
|
I have the below code,
function MyFunc(){}
var myFunc = new MyFunc();
myFunc(); // through TypeError this line,
How can I make it to work if I want to call the function through ... |
I have an array in JavaScript that can go as deep as I want:
var steps = [
{ "step_id" : "1", "step_name" : "Step 1", "children" : ...
|
I am using a plugin JS and need to call a function in it.
It is having functions inside a variable like,
var win = window;
var Page = function(pageOptions, callback) {
...
|
Using ternary operator requires two calls to the function.
var colour = (tryAdventurousColour() != null) ? tryAdventurousColour() : 'black';
Possible to do it in 1 line?
EDIT: Fixed syntax
EDIT: Like this but better
var colour ... |
I know I have a thread about the sorting function I'm about to post, but this problem doesn't deal with the sorting itself, but rather the fact that a variable is not passing. The code below is the relevant part to an autosuggest feature. The variable that isn't being passed is "firstValidIndex". It is being set appropriately, but when it is ... |
|
|
|
var url1 = 'http://www.penguins.cl/penguin/gentoo-penguins.jpg'; var url2 = 'http://farm1.static.flickr.com/29/89928702_4a59eb86d8.jpg?v=0'; var url3 = 'http://www.focuspocus.org/photodata/0124_jellyfish.jpg'; var img1 = new MyImage(url1, dimensions); var img2 = new MyImage(url2, dimensions); var img3 = new MyImage(url3, dimensions); function MyImage(inURL, inCallback) { // NOTE: assigning 'this' to a variable isn't arbitrary. // It eliminates scope problems that arise when trying // to use 'this' inside nested functions var t ... |
//////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////// function process_fx(elementGroup) { // fx content consists of 2 parts // first is the name of the function to perform, second is element to perform on var elements = elementGroup.split('|'); var function_name = elements[0]; var element_id = elements[1]; // Perform the function on the element_id function_name(element_id); } //////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////// function unhide_me(element_id) { alert("Got here!"); Element.removeClassName(element_id, 'hidden'); } //////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////// ... |
|
Change the VBScript to Javascript, and it will be able to access themI do not think it is possible to access Javascript variables or functions from VBScript. The two languages are capable of the same things, I think (meaning if you can do something with one, it is possible with the other), so seriously the way I would probably go about ... |
|
|
Thanks for the tips. I was searching for info about how to do this a month or two ago and found very little information. I did find out how to do it using the window object as you mentioned. As for your code, would it be something like this?: //then someObj[foo](arg1, arg2 ...) The someObj[str](arg1, arg2 ...) throws me because I ... |
|
|
Hi, I have a scenario where I need to call a function from inside another - however, the name of the function is passed to the 'calling' function as a variable... Code: function mainFunc (otherFunc,strParam) { .... } function alertMe (message) { alert(message); } mainFunc('alertMe','hello world'); ...the question is: how do I make mainFunc() call alertMe() when that function name has ... |
I'm pretty rusty at Javascript - this should be a simple one. I have a form with a select field that runs a function onchange <.....onchange="setProject(this.value)" ...> In my script I have Javascript that looks more or less like this: var ABCD = "This is the ABCD content"; var EFGH = "This is the EFGH content"; function setProject(value) { document.getElementById("change_me").innerHTML = ... |