Referencing An Object's Fieldnames

Apr 12, 2006

A have an array of objects defined like this:

var collegas =
[{smtp:'alberic.verhelst@king.dom',voornaam:'Alberi c',famnaam:'Verhelst'},
{smtp:'anita.dierens@king.dom',voornaam:'Anita',fa mnaam:'Dierens'}, etc


I iterate over this array with this code :

for (var i = 0, stop=collegas.length ; i < stop ; i++) {
for (var veld in collegas[i]) {
etc

I would like to check whether a particular veld instance's name is smtp. In
code what I want is this :
if (veld.fieldName=="smtp") { do something ...

But this syntax doesn't work.....

View 2 Replies


ADVERTISEMENT

Referencing Arrays Of Objects?

Sep 16, 2010

I am trying to return a JSON string from a server with a list of locations. I want to populate a div with checkboxes and the names of the locations.This is the JSON string I am currently working with:

Code:

[{"loccode":2,"locdesc":"Atlanta"},
{"loccode":1,"locdesc":"Charlotte"},
{"loccode":0,"locdesc":"NA"},
{"loccode":3,"locdesc":"Test1A"}]

I have a similarly formed data definition that is hard coded in the javascript for permissions that looks like this:

Code:

var prm = [
{"id":110,"idtext":"110","prmdesc":"Users"},
{"id":130,"idtext":"130","prmdesc":"Forms"},

[code]....

When i run that bit of code it displays Test1A and that is all.I am certain I am missing something basic, but I have not been able to figure out what it is.

View 3 Replies View Related

Accessing Fieldnames With [] In Them

Jul 22, 2003

Is there a way in Javascript to access a field with [] in it for example
destList[]. I need to have this since the field is a listbox and it contains multiple options. it gets posted to the server and handled by PHP. in order to have all the options submitted to the server the name of the field needs to have a [] on the end of it.

View 5 Replies View Related

Objects Under Mouse - Return An Array Of All Objects Underneath A Certain Point

Apr 17, 2011

Is there a way in Javascript or Jquery to return an array of all objects underneath a certain point, ie. the mouse position. Basically, I have a series of images which link to various web pages but I have a large semi transparent image positioned over the top of the other images. I want to find the href of the background image that the mouse pointer clicks over.

View 1 Replies View Related

JQuery :: Extending Objects With Internal Objects?

Sep 5, 2009

Is there a better way to extend object with internal objects?

$.fn.bestShow = function(s) {
var d = {
width: 0,
height: 0,
order: "numeric",
orderBy: "",

[Code]...

View 3 Replies View Related

Referencing Value

Oct 6, 2004

I'm trying to get a value from a link that a user click on in a pop up window and send it back to the parent window. It's working fine in mozilla and some IE but i'm having problem in IE 5 and some IE 6.

<a href="javascript:opener.document.getElementById('<?php echo $_REQUEST[partid];?>_partremoved').value = '<?php echo $partnum;?>'
opener.document.getElementById('<?php echo $_REQUEST[partid];?>_partinstalled').value = '<?php echo $partnum;?>'window.close();">
<?php echo $partnum;?></a>

View 4 Replies View Related

Referencing A <tr> Object

Jul 23, 2005

if i have this code: <form><input type=text name="id1"></form> then with
javascript i can reference this with this.form.id1, how can i reference
something like this:

<table>
<tr name="id2">
..
..
</table>

?

this.id2 doesn't work

View 5 Replies View Related

Referencing A DIV Within A Form?

Oct 29, 2009

whenever I run the below code I am unable to hide my <DIV>. I have posted a previous post regarding hiding DIVs however as this is slightly different I thought I would create a new topic here to allow for easier searching for other users.

The below code works if the DIV is outside of the form however if I enter it within the form nothing happens.

<form name="formcreate" method="post" action="">
<table width="80%" border="0" cellspacing="2" cellpadding="2">
<div id="div1">
<tr>

[Code].....

View 4 Replies View Related

Referencing Other Page's Dom

Aug 28, 2007

Is there a way in the Javascript to reference the dom of another page that is online. An example would be if www.cnet.com has an element with an id = money can I reference that page with an object that and get a value from the money element and display it on my page. I know this sounds confusing but really i just want to be able to save a xhtml page that is not on my website. Create a input filestream from that page and use data from the filestream to make data on my own page.

View 1 Replies View Related

Referencing Parameters In JS, POST Vs. GET

Jul 20, 2005

I would like to reference the "name=value" parameters sent to my page
(submit'ted from a previous page with a <form>.) in my javascript.

I can do it if my second form is called with a "get" using the
window.location.search property, etc.

I don't know where these parameters are if my second page is called with a
"post"...

View 1 Replies View Related

Referencing A Function Through An Array?

Jun 1, 2010

I am loading a set of icons using an array. The reason for this is that the icon set will be different depending on what some PHP code has given to the JavaScript.

My code currently looks like this.

Code:

var things_to_load = new Array();
things_to_load['header_cursors'] = new Array( 'default' , 'pointer' );
things_to_load['header_icons'] = new Array( '../img/triggers/to-roll/undo.png' , '../img/triggers/add.png' );
things_to_load['header_labels'] = new Array( 'undo' , 'add' );

[Code].....

The problem I have is that the click function gives the error "things_to_load.header_clicks[c] is not a function".

This makes sense as presumably the click function is saving the value and not what that value references.

how I can get this code to save the function not the string referencing it?

View 5 Replies View Related

Referencing Form In Variable?

Feb 10, 2009

i have a simple thing that causes me all sorts of headaches. I have many forms on the same page, and identical items in each form. The same object in each form call the same procedure. So, I'm passing in the form value, such as:

onchange="DoMyFunction('formName');"
and then in the procedure i do:
function DoMyFunction(formname){
document.[formname].object.value='1';
}

Now i have functions like this all over, problem is getting them to work. Once they work, they work fine. But when i add a new one, it can match an old function (except the object being referenced) and it won't work!

Does anyone know the proper way to reference a form in a function?

View 4 Replies View Related

OnMouseMove And Referencing A <div Id> Underneath Another <div Id>?

Sep 2, 2010

My functions for mouse_move / up / down all control the movement of a box. So you can click a box and move it anyway. It then snaps to an invisible grid. However there are multiple boxes on the screen so if you move it to a spot where another box already resides, then that box needs to swap places.This is what the mouse_over function tries to do. When I click the first box it stores the position of that box that was clicked. If I release the mouse button whilst hoovering over another box I want the other box to take the stored positions of the first box.However what I think is happening is the mouseover function is applying the new position to the box I'm moving, as I guess this is the first layer the mouse is over.Is there anyway I can reference the layer underneath using onmouseover.

<script language="javascript">
var x;
var y;

[code]....

View 5 Replies View Related

Referencing The Correct Object?

Dec 9, 2010

I have a table which I would like to be highlighted with the click of a button, but I can't seem to reference it correctly. I can make the <td> clickable and function, but when I try to apply it to the button I can't make it reference the td cell, rather than change the background color of the button.The function is:

function roll(obj){
obj.style.backgroundColor == "pink" ? obj.style.backgroundColor = "#e5e5e5" :
obj.style.backgroundColor = "pink";

[code]....

View 7 Replies View Related

Referencing A Checkbox Via A Variable

Apr 17, 2007

for(x = 1; x < totalCheckBoxes; x++) {
checkBoxName = "document.addProductEditor.journalEdit_" + x;

if(checkBoxName.checked == "true") {
//updatedJournalList = checkBoxName.value + ",";
}}

The problem is that while checkBoxName produces the correct variable, the final if statement claims that checkBoxName.checked has no properties. What am I doing wrong?

View 3 Replies View Related

Referencing A Field On A Form?

Dec 9, 2010

I have validation code on my web form used by passing in the name of a field on the form. I have fields on my form named Hospital1, Hospital2, Hospital3, etc. I am trying to write a For loop to validate each one:

with (thisform)
{
{for (i=1; i<=9; i++)
{

[Code]....

What is the proper format of var vHosp= "Hospital"+i; so that it will recognize that field?

View 7 Replies View Related

Using Prototye Referencing Parent ?

Mar 18, 2011

My code is below it is pretty straight forward, but it is not working

What I want to do is build a generic class "car" then call it using a prototype

Code:

View 3 Replies View Related

Referencing Elements Within An Iframe In Firefox.

Jul 23, 2005

I've written several utility pages that use a dynamically created
iframe. The iframe typically has a form that is populated by the main
page. Then the form is submitted to be processed, and the returning
page does something -- call a function on the main page, change a
variable on the main page, etc.

All this stuff I created works on IE. Sorry, didn't have other browsers
available to test. Now I have access to a machine with FF, and none of
these scripts work.

So, short and sweet: What is the proper way to reference a form on an
iframe from the parent doc in firefox? Also, call a function from the
parent to the iframe, and vice-versa, call a function on the parent doc
from the iframe when it loads?

View 6 Replies View Related

JQuery :: Referencing An Object In An Onclick?

Jan 8, 2011

I have created an object called list. the object has a method called load and a method called setSelected (it has more, but they arn't impotant here).

The load method prints out table rows like this:

str+="<tr>"+data+"</tr>";

and in the end, inserting str as the body of a table.

what I want to do now, is have an onclick event for each of these table rows, that calls the setSelected method of the current object. so for example, if I'd write this on my page:

mylist = new list(args...);
mylist.load();
<div id='associated-div'></div>

that if someone clicks a row in the table that is created in the div, the setSelected method of my list oject will be called.

View 1 Replies View Related

JQuery :: Referencing An Unnamed Form?

Apr 7, 2010

I am using the following system to create my forms : <% using (Html.BeginForm()) { %> Now I want to refer to the form in JQuery, but all the examples I can find refer to the form by it's name. How do I refer to my form if it doesn't have a name?

View 2 Replies View Related

Referencing Two Elements From A Single Function?

May 31, 2010

I have this function:

Code:

$(function () {
$('#Tags').tagSuggest({
separator: ", ",

[code]....

This references the #Tags element which is an input text box. I would like this function to run on another element also (#Tags2). So if either the #Tags or #Tags2 text boxes are used, the function runs.How can I extend this function rather than duplicating it?

View 14 Replies View Related

Referencing Main Page From IFramed One

Jun 25, 2009

I have a script which works from my main page, but I need to embed it also into an iframed page, and have it affect the main page from there as well. In my main page, I have the following iframes:
<iframe id="main">
<iframe id="player">
<control buttons embedded on main page, along with the iframes>
The default source of "main" is page A, which is a frameset of pages B and C. In page B, I want to embed the same controls I have on the main page, and have them affect the main page from there.

Here's the controls script from the main page - it works from that page - a resizing onClick of the "player" iframe:
<head>
<script language="JavaScript">
function resizeIframe(iframeId, iframeHeight, iframeWidth)
{
if (iframeWidth>0)
{
document.getElementById(iframeId).style.width=iframeWidth;
}
if (iframeHeight>0)
{
document.getElementById(iframeId).style.height=iframeHeight;
}
}
</script>
</head>
<body>
<a id="widenButton" onclick="resizeIframe(player', 420, 720)return false;">Enlarge Player</a>
</body>
How would I put the widenButton in that back page and still have it affect the front page?

View 1 Replies View Related

Referencing Object Array Dynamically

Dec 3, 2009

What I'm trying to do here is even possible.

I've tried numerous variations of the alert line with evals, brackets and jQuery syntax but always seem to get the error:

XML filter is applied to non-XML value ({one:["1", "2", "3"], two:["a", "b", "c"]})

Which makes me think I'm either attempting something stupid or only missing my target slightly.

The code will be running within a jQuery project up if that helps in any way.

View 4 Replies View Related

Referencing Values On A Drop-down Menu

May 8, 2006

I have managed to write a working script to add together two values and display the total. I need to advance from that stage and now I have a 'quantity' box and a drop-down menu with a few options on it, each relating to a price. I am trying to take the quantity entered by the user and multiply it by the price they select from the drop-down and display it in a third box. So far I have:

two = document.autoSumForm.value from menu.value;
document.autoSumForm.total.value = (one * 1) + (two * 1);

How can I rewrite the above to account for the different choices a user can make on a drop-down menu?

View 3 Replies View Related

Creating And Referencing Previous Variable?

Nov 6, 2009

I'm trying to build a page that shows random, alternating divs, and have looked at this page as an example. However, the issue at the moment is that although the divs display randomly, they do not disappear in order.The finished "page" is to be referenced by another page that I do not have control over. Here is the section of the file containing JavaScript:

<script type="text/javascript">
var curcontentindex=0
var messages=new Array()

[code]....

I've found very little info on how to reference a previous variable...maybe create an array to store them in, but wasn't sure how to go to the previous value in the array.

View 3 Replies View Related

[RESOLVED] Referencing Flash Object In IE?

Apr 22, 2010

I am having trouble changing the value of a flash object using JS in IE. The flash code is below

<object id="FlashID" classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" width="721" height="423">
<param name="movie" id="movie" value="../../flash/world.swf">
<param name="quality" value="high">

[code]...

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved