Use A Var For Index In An Object With {} Notation?
Apr 26, 2011
i want the following var i="name";console.log({i:'value'}); o be equivalent to (as an end result)
var i='name'; var t={}; t[i]='value';console.log(t); is that possible?or must i use the second method?
View 2 Replies
ADVERTISEMENT
Oct 9, 2010
I have the following code:
A = {
"value": "a",
};
B = A ;
B.value = "b";
alert (A.value); // => b
I expected A.value to be "a". how can I change values of a new object, without changing the parent-object?
View 6 Replies
View Related
Nov 28, 2005
I am having a terrible time getting the following code to work:
var foo = {
bar : "bar",
fooTwo : {
bar : foo.bar
}}
When this code runs, I am told that foo.bar does not exist in line 4. Why am
I getting this error?
View 3 Replies
View Related
Apr 30, 2007
Is it possible to have something like the following so that 'three'
can access 'one':
var x = {
one: 1,
two: { three:this.one } // Or parent.one ?
}
If not (which I have nearly come to a conclusion on) what is the next
best way to accomplish this?
View 5 Replies
View Related
Jul 1, 2009
I'm declaring a class in OLN:
Code:
The problem is that in IE, when I call myfunc() it complains with the error: Class is undefined
I'm not sure what I'm doing wrong. Class is declared in as much global scope as possible, and that shouldn't even matter in JS.
View 3 Replies
View Related
Aug 23, 2011
I'm trying to put a function in a object created using JSON notation. The syntax looks like this...
Code:
historySet = { ajaxRunFunction: "updatePageCopy('" + pageID + "','','" + pageName + "')"};
It works fine in FF, but in IE it calls the function updatePageCopy when it creates the object history set. I don't want to call the function when the object is created.
View 1 Replies
View Related
Aug 25, 2010
I am trying to get the index of a li with a specific class. I know I'm selecting the right object because I can apply a CSS class to it (eg change border colour) but when I try to get the index it returns -1. But I know the object exists as I can alter it. :-s
jQuery(document).ready(function() {
var active = $("#tertiarynavigation .bordered").get(0);
var num = $("#tertiarynavigation li").index(active);
alert("Index: " + num);
[Code]......
View 1 Replies
View Related
Jan 13, 2006
I'm having difficulties to understand why the code below doesn't work.
The idea is to generate an <iframe> with a higher z-index compared to
an <object>. In Microsoft Internet Explorer 6, everything works fine,
but Firefox/Netscape seems to have problems with this construction.
Am I overlooking something ? Code:
View 2 Replies
View Related
Aug 27, 2011
I have an array "arr" that is an array of objects. Each object has the same 7 properties.I want to find the index of the object with a property that matches a certain value x in the array arr. How can i accomplish this?The array has hash tables associated with it.arr [ obj [ i ] . property1 + "_" + obj [ i ] . property2 ] = arr [ i ] ;so whats the index of the object where .property1 = x ?
View 2 Replies
View Related
Aug 25, 2010
I'm building a webpage using javascript and iframes. Basically I have an iframe in the middle of the index.html page that links to another html page (let's call it iframe.html). My question is, is it possible to call a javascript function from iframe.html to control an object on index.html? If so, how do I do this? I'd like to be able to assign an image in iframe.html with the hyperlink of href="javascript:function()", where the function effects the CSS of a div on index.html.
View 2 Replies
View Related
Aug 8, 2005
I have difficulty understanding how square brackets work in JavaScript and this is causing me difficulty retrieving the values of the options of my Select controls.
My form contains many select boxes. Their names are stored in variables(in this case concat is the select control name) and I have no trouble accessing methods for the select object ie:
document.Allan.elements[concat].selectedIndex;
I would like to get the value of the selectedIndex but I am having difficulty because I don't know the right syntax. I'm looking for a statement like the one that follows but uses variables
document.form.theDay.options[2].text
Could some one help me use the right syntax?
View 3 Replies
View Related
Aug 17, 2010
I've started learning writing javascript objects with literal notation...
Instead of the usual syntax...
The problem is that it's hard for me to adapt procedures which I'm used to within the normal syntax for the literal notation. E.g:
Is this variable global or local? If it's local, how do I declare a variable globally? I also wonder if it is possible to bind events to objects from within the object? And if I'm correct - jQuery is coded this way, but how can they then make use of their selector:
When it is an object defined with literal notation that doesn't have a constructor?
View 2 Replies
View Related
Oct 7, 2005
I did some searching around, but didn't see this addressed directly. Here is an example of when dot notation fails in Firefox, and when SetAttribute doesn't fail: Code:
View 4 Replies
View Related
Jan 26, 2009
I have the below array called "results". When I loop through all document elements I would like to check "field_name" against the "results" array and see if it exists and what index number it is at??
// Split the comma delimited response into an array
results = result.split("~");
//Loop through array and populate fields[code].....
View 9 Replies
View Related
Oct 3, 2011
I'm trying to get a return of
[
["red","green","blue"]
,["blue","red","green"]
[code]....
View 10 Replies
View Related
Nov 3, 2011
I have a problem with layers. In my example there's a link inside div#msg with 'z-index:1' and a overlay with 'z-index:2'. Now when "mousedown" fires, will change the div#msg z-index value from 1 to 3 to be on Top, so the link become a clickable link.
The question is, it is possible to make the link on top and open it with just one click?
This example can do that but won't open the link!
HTML Code:
View 5 Replies
View Related
Aug 7, 2009
I have a line which looks like this in PHP:
Code:
<input id="btnCancel$folder_id" type="button" value="Cancel" onclick="swfu.$folder_id.cancelQueue();" disabled="disabled" />
and of course when output looks like this:
Code:
<input id="btnCancel111" type="button" value="Cancel" onclick="swfu.111.cancelQueue();" disabled="disabled" />
It seems that the .111. throws an expected ";" error. swfu.cancelQueue(); by itself does not.
These objects are being defined in a function which takes in the folder ID as a variable, and then builds using this line:
Code:
swfu[folderId] = new SWFUpload(settings);
View 3 Replies
View Related
Nov 19, 2011
I just got this script for a countdown on a website and I got it to work locally but when I upload it to the server i get the error "index.html:22 Uncaught TypeError: Object [object Object] has no method 'fancycountdown'".
I have checked to make sure all other javascript files are loading and they are and I can't figure out whats wrong. You can see it [URL]
View 2 Replies
View Related
Jul 23, 2005
I have 2 "divs" in my page, as defined below. Given teh z-index values, I would expect the text in the "flash" class to overlay the video div.. But all I see is the video div. Code:
View 2 Replies
View Related
Aug 13, 2009
alert(document.getElementById("elem").style.zIndex);
That code does not work! Even if I use parseInt it then it only shows NAN in the alert box.
View 4 Replies
View Related
Jul 23, 2005
I need to set tabs on java generated pages. Pages have four sections:
header, sidebar, body, and footer. The sidebar and body change dynamically.
The tab key must go to anchors, fields, and buttons doing all in the header
first, all in the sidebar second, etc. A base page contains includes for all
the pieces and has the body tag. Code:
View 8 Replies
View Related
Oct 11, 2011
I'm having problems with finding the index of a row based on a onclick of an image within a row. I have no row id and all my rows have the exact same name.
<tr><td><input id='var1' type='text', onclick = "getRow(this)" /></td><td><input id='var2' type='text', onclick = "getRow(this)" /></td></tr>
function getRow(rowValue)
{
[Code]....
View 2 Replies
View Related
Apr 2, 2011
Just started to dabble with jQuery I can get the id for a clicked element, but how can I retrieve its index number within the class?
Code:
$(".heading").click(function () {
$("#containContent").slideToggle(100);
//window.alert($("#containContent .content").length);
window.alert(this.id);
});
Hopefully I can do this from the 'this' reference without having to backtrack through the id?
View 10 Replies
View Related
Feb 23, 2006
I have a proscroll javascript on my website. Does anyone know how to change the z index. I want things like my dropdown menus to appear above the scroller. Here is the code for my proscroll.
<APPLET height=23
width=780 code=scrolltext.class><PARAM NAME="text" VALUE="My text is here">
<PARAM NAME="info" VALUE="">
<PARAM NAME="bgcolor" VALUE="ffffff"><PARAM NAME="fgcolor" VALUE="000000">
<PARAM NAME="fonttype" VALUE="verdana">
<PARAM NAME="fontsize" VALUE="12"><PARAM NAME="fontstyle" VALUE="1">
<PARAM NAME="delay_time" VALUE="10"><PARAM NAME="link" VALUE="">
<PARAM NAME="target_frame" VALUE="_self"></APPLET>
View 2 Replies
View Related
Apr 1, 2010
I have an array of integersI like to retrieve the max number and index of max number from that array without using Math.Max() function..Presently in this below code, I have 4 dynamic values, end user will be select degree from combo box, entering the values semester, Max marks and Obtained marks as numeric values. Once entered dynamic rows will be created and it also calculate the percentage by the formula (om/mm)*100 for each row on clicking Sum and it also creates new columnŠI needed to have code when the degree changes only.. it should calculate the sum of all max.marks and Obtained marks of each semester and then calculate percentage by above formulaŠ and also new column should not be createdsort with max markswhat is the easiest way...
Cheers
Santhosh
function insRows()
[code]....
View 2 Replies
View Related
May 25, 2011
I want to Show Videos inside an Image of theater curtains, image should float ABOVE the videos. Cant work out why it wont work, I have.
<style type="text/css">
#tablist{
padding: 3px 0;
margin:0;
[Code]....
View 2 Replies
View Related