I have the name of a function in JavaScript as a string, how do I convert that into a function pointer so I can call it later?
Depending on the circumstances I ... |
I am new to stackoverflow but I found it pretty helpful several times. Now I have my own question: Is there a way to convert variable names to strings in javascript? ... |
How can I hook up an event to a function name I have defined as a string?
I'm using Prototype.js, although this is not Prototype-speficic.
$(inputId).observe('click', formData.fields[x].onclick);
This would result in JavaScript complaining that ... |
I have a function from an object, lets say Object.MyFunc.
I need to send this function name into another function like so: doSomething("Object.MyFunc");
any advise?
|
This way I could have a function that says whatever_way_you_do_this = something. Is this possible? Basically I could tell a function which variable I want to set by giving it a ... |
I'd like to fire a function. Unfortunately I can't call it directly as the functions' name is provided as a string.
Example:
function myFunction() {
alert('I am myFunction');
}
function anotherFunction() {
... |
<script>
//in one script
var someVarName_10 = 20;
</script>
I want to get access to this variable from another script by name of variable. With window object its simple, is it possible with local variable?
I ... |
|
Hoping someone can assist and hoping this is possible in JavaScript. I basically have the following string in the format:
A,B,C:D,E,F
What I am trying to achieve is a means of pairing up ... |
Example, I have an array called 'categories' with the value ['4','9']. I'm trying to use that value with the name of a previously defined array. I have several arrays defined earlier ... |
I have an HTML page.
I would like to extract all elements which name starts with "q1_".
How can I achieve this in JavaScript ?
Thanks !
|
I am now in the process of removing most globals from my code by enclosing everything in a function, turning the globals into "pseudo globals," that are all accessible from anywhere ... |
Let's say I have this (assume the name variable is "receiver"):
if (!(receiver instanceof com.HTMLReceiver)) {
throw new com.IllegalArgumentException(
name + " ...
|
My Javascript ain't so hot, so before I get into some messy string operations, I thought I'd ask:
If the current url is: "http://stackoverflow.com/questions/ask"
What's a good way to to just get: "/questions/ask" ... |
I am running a self executing function in javascript to not interfere with any global variables on a page. I have a string with the name of a function I want ... |
I'm trying to access a nested function by passing the function name in as a string and then calling it. Eg, see this post
function outer(action){
window["outer"][action]();
...
|
Is there a way to get a variable name as a string in Javascript? (like NSStringFromSelector in Cocoa)
I would like to do like this:
var myFirstName = 'John';
alert(variablesName(myFirstName) + ":" + myFirstName);
--> ...
|
How can I use string argument input as a part of variable name in a Javascript? I want to do that because it seems to be tedious to define getter and ... |
|
I have many JS object literal files in my code. In a JS function
data=data9.webb9[i];
I am accesing it in this way
with help of
script type="text/javascript" src="webdata"> script
in head tag
How could I
do ... |
I started reading Javascript: The Good Parts book and became confused at first pages (7 and 9 if be exact) by the railroad diagrams.
There are diagrams for the name and the ... |
//window["Fluent"]["Include"]
function setGlobalVariableByName(name,value)
{
var indexes = name.split(".");
var variable = null;
$.each(indexes, function()
{
...
|
I've seen a few other posts about this on Stack Overflow, but the answer always seems to be to create an object with key / value pairs. This doesn't seem to ... |
|
Say I had a bunch of elements with id names "id1", "id2". "id3" etc. Then say I had a function that adds a click handler such that when you click these elements it gets the id name with this.attributes[1].nodeValue;. Then say I had a bunch of arrays with the same names as the ids var id1 = ["data", false, 45]; var ... |
|
I have a script which grabs window.location, splits it and then puts part of it into a string. The script also defines a number of arrays. I want to use the string to pull elements out of an associated array (assuming it exists). For example, if the string value is "X" I want to pull elements from the array that is ... |
I have declared in my JSP a select tag with the following: onChange = "onChangeAction('<%=action%>', '<%=id%>', '<%=key%>', '<%=pageNum%>')" the problem is that the key includes a username so when the user's name is O'Reilly I get this: onChange = "onChangeAction('1', '20', '775954255_O'REILLY', '1')" ...naturally this breaks the entire page since the apostrophie hoses up that string. Anyone have an idea how ... |
|
I have a form that works like this: you see a list of dog types, and if you have one of those breeds, you click the checkbox next to it. Clicking the checkbox reveals a radio button group. This all works fine, but now I'm doing validation which first checks which checkboxes are checked, and then checks the radio buttons. I'm ... |
I agree with jsKid, there doesn't seem to be any need to reference the array by a string containing its name. if you wanted to do this, it would be better to create a container with a string reference for the array, then use the string reference elsewhere... there's a couple ways to do this: Code: JS wierdness |
|
|
Greetings, I am barely literate in JavaScript, but I have done my best to try figuring this out on my own. I am playing with a Drag & Drop uploading script for HTML 5 that i found here: http://www.sitepoint.com/html5-file-drag-and-drop/ I have been able to get the script 95% set up to allow uploads, but it has a problem parsing when ... |
|