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
ADVERTISEMENT
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
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
Mar 26, 2007
I am experience some problems reading a form variable from a
Javascript function. The point with this particular variable is that
its name has the following syntax:
<input name="tx_impexp[tt_content:159]"/>
I want to set this var to 1 from my javascript function, so I tried
to execute the following line of code:
document.frm_1.tx_impexp[exclude][tt_content:159].value=1;
Unfortunately the following error come up:
Error: missing ] in index expression
document.frm_1.tx_impexp[exclude][tt_content:159].value=1
--------------------------------------------------------------|
It seems Javascript expects to close down the bracket at the position
marked...An easy solution would be to change my var syntax but the
point is that I cannot since I am using an already made script and I
should not modify it.
Just wandering if this is due to a syntax error defined according to
Javascript specification language or there is something wrong with
this.
View 5 Replies
View Related
Jun 12, 2011
Can anyone tell me how I can check to see if a checkbox has actually been checked or not? The code I need to use this in basically gets data from a form which has alot of dropdowns and a checkbox in it. The function builds a query based on the values it finds in these variables. I was trying to check to see if the checkbox was selected and if so assign a value to another var but I can't seem to get it to work.
The checkbox is called pics.
if (pics.checked) {
var photos = "Yes";
}
else {
var photos = "No";
[Code]...
View 7 Replies
View Related
Mar 2, 2010
Im trying to create code that will set the variable x to 1 if the checkbox is checked and 0 if it is not.
HTML Editor
<head>
<title>Jessica prectice form</title>
<script type="text/javascript">
function ProcessForm(){
[Code].....
View 1 Replies
View Related
Jan 18, 2011
I'm trying to set a variable that holds the value of a checkbox, however the .val() option returns the value of the checkbox at page load, if i click on it the value remains the same.
[Code]...
View 2 Replies
View Related
Dec 8, 2010
I was wondering if someone could help me on a problem I have been having. In my code my function is supposed to take the elements of the form and it checks to see if it is checked or not. After that it would store it in the variable checkbox. However when I test it out it will not store it in the variable. For example if I picked sleep/ standby checkbox and hit submit it will show as 06 instead of just 6. Don't know what I am doing wrong. Here is my [code]...
View 2 Replies
View Related
Feb 22, 2011
i would like to declare a variable or input value called "module2" and have its value set at either M1 or M2 based on if a checkbox (called module_2 is selected or not. ie if the box is ticked module2 value="M2" .
i currently have something along the lines of this
function setmodule2() {
if(module_2.checked == true) {module2.value == "M2";}
else{idf_form.module2.value == "M1"}
}
[Code]...
View 3 Replies
View Related
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
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
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
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
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
View Related
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
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
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
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
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
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
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
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
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
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
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
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