Have the Javascript function below which takes the name of an input on the form passed as a variable so that 1 function can check many inputs as I have up to 3 fields per form that can accept this data range.
function contact_number_check(formObj,field)
{
var obj = document.forms[formObj];
var regExp = /^([0-9 ])+$/;
alert(field);
this is my first time posting on this forum. Hope you could help me. I am a beginner when it comes to Javascript. Here is my first stumbling block in this language.The code that works
I am having field names in HTML with a period in them for e.g. <INPUT TYPE='hidden' NAME='cars.toyota.camry' VALUE=དྷK'> I need to know how to access this field name in Javascript.
I have several fields being updated for a parking structure... The client inputs the number of cars and can immediately see the percentage before updating the database....
The field names always change so I need the JavaScript to be able to pick up the unique field names calculate and place into the total field box...
I found this code online, but I need to do this dynamically for hundreds of lots...
So basically I have a field name and an ID number identifying the 3 related fields...
Here's an example that works for one lot:
<HEAD> <script type="text/javascript"> <!-- Begin function startCalc(){ interval = setInterval("calc()",1);
I have a form that generates field names dynamically based on a number selected from a drop-down. For instance, if I select 5 from the drop-down, it will generate 5 fields with the names email1, email2, email3, email4 and email5.
How do I loop through these to determine which ones are empty?
Code: while (i<=ulimit) { emailval = "document.myform.email" + i + ".value"; //alert(emailval);
I have a table that I populate with an array using ASP. As each row is created, the form object names are appended a numeric, such as:
i = 1 <select name="select<%=i%>"> ... ... ... i = i+1 next
I then pass "i" to a javascript function, so that I can access the values of each form object. I can't figure out how to properly concatenate the "i" and still allow access to the value in the form object. Currently I have:
var ps = 'platSymbol' + I; alert(ps) var sel = 'document.frmUpdPlatGrp.' + ps + '.value' alert(sel)
I know I'm wrong, as this comes back as a complete string. Ultimately I want to have something like this:
var s = document.frmUpdPlatGrp.platSymbol2.value - so that I can actually get the value.
I need to create 14 javascript Ajax objects and assign properties and events to them. Since most of the code is just being repeated, I'd like to do the whole thing in a loop using an array for the object names. This is a portion of the code as it now stands:
boxe2_tree = new dhtmlXTreeObject("boxe2_div", "100%", "100%", 0); boxe2_tree.enableCheckBoxes(1); // etc. boxe2_tree.loadXML("./xml/boxe.xml",function(){loadTree('boxe2_tree');}); warn2_tree = new dhtmlXTreeObject("warn2_div", "100%", "100%", 0); warn2_tree.enableCheckBoxes(1);
Here's my problem: I need to create a variable name dynamically, made up of a string (say "var_name_") and an integer. Ultimately I want something like this:
var_name_1 = 'whatever value I want' var_name_2 = 'whatever value I want' var_name_3 = 'whatever value I want' ... var_name_N = 'whatever value I want'
But the actual variable names are determined at run-time, so I can't just hardcode them.
Any suggestions? JavaScript doesn't seem to have a Variable type, so I can't just cast a string into a var...
I have a form with several types of checkboxes, and I'm trying to check all but one of them to determine if any of those have been checked. I do not want to check 'all', but I want to see if any of the 'check_' or 'check2_' checkboxes have been checked. There are a variable number of checkboxes, so this is just an example with two of each. Set 1 and Set 2 will always have the same number of checkboxes as each other, though.
Code:I am having problems with the following. I am wanting to hide <tr> in my table (employees) and only show employees that are in the selected department (selected via dropdown box).I need to set a javascript array to a php array. I am looping and assigning the array and am wanting to pass a javascript variable as the index in php array. I have marked my problem lines in red. Thanx for any help.
<script type="text/javascript" > function display_elements() { var departments = new Array;
I'm trying to use variable variable names using the window[] functionality. It works fine when you literally specify an array's base variable name, but I have a multidimensional array and would like to use window[] to build the name of the specific sub-array I'm looking for, like so:
// here's my multidimensional array myArray = new Array(); myArray['id'] = 'foo'; myArray['sub'] = new Array();
[Code]....
However if temp is the name of a sub-array (e.g. 'myArray[sub]), and not the base array name(i.e. 'myArray'), then window[temp] evaluates to "undefined".
Can the window[] functionality handle this somehow, or do I have to resort to eval() or something else?
I'm trying to use variable variable names using the window[] functionality. It works fine when you literally specify an array's base variable name, but I have a multidimensional array and would like to use window[] to build the name of the specific sub-array I'm looking for, like so:
Code: // here's my multidimensional array myArray = new Array(); myArray['id'] = 'foo'; myArray['sub'] = new Array(); myArray['sub']['id'] = 'bar';
I am working on a project where I need to redo the same thing with new variable names
Code JavaScript: var paper1 = new Raphael('img1', 500, 500); c1 = paper1.rect(0, 0, 50, 20, 5); var paper2 = new Raphael('img2', 500, 500); c2 = paper2.rect(0, 0, 50, 20, 5);
I would like to be able to do this with a for loop. So in the above example I would want paper+i, img+i, and c+i was trying eval("paper"+i) but didn't work.
I am doing a project where I would like to be able to generate a series of variable names dynamically in the following example
var paper1 = new Raphael('img1', 500, 500); c1 = paper1.rect(0, 0, 50, 20, 5); var paper2 = new Raphael('img2', 500, 500); c2 = paper2.rect(0, 0, 50, 20, 5); would like to use a loop to increment names for (i=0;i<=5;i++)
Last evening I ran across this script which I think will address a need I have; replacing my radio buttons with images. The one difference I have is that I need to use a different button image for each of the 5 buttons in my group.Unfortunately, the script dose not apply unique classnames within the generated mark-up so if I'm to use this I need to apply some sort of counting variable that increments and use this variable to append the classname with.Around line 52/53 of jquery.checkbox.js is
Code JavaScript:
/* Wrapping all passed elements */ return this.each(function() {
I am having some trouble with my code in that I am trying to take the value from the date of birth field and check to see if over 18 years old. I they are not over 18, a window.alert dialog box pops up to tell them. Below is the check if 18 validation.
Script section in the document head:
//check if over 18 function overAge(){ var age;
[code]....
Code for body section:
Date of Birth: <br/> <input type = "text" name = "date" value = "(mm/dd/yyyy)"/>
What I am wanting to do is have my form open up a new part of the form when the previous sections are filled out. i.e name field shows, when it has content, the next field opens up for it to be filled out, and so on.
I have a input field (text field) in my html page. User should give input as a string like following 12 345 678,0 If user gives input in format 12345678,0 and leves the input field how can I format the value 12345678,0 into format 12 345 678,0?
Are there any Javascript that can handle this with Regular Expressions?
If you click the link on [URL].. a form pops up. How do I set the value of the URL text field in the form to be equal to the url of the page it originated for i.e in this instance it the value would be[URL]... i believe would set the value to the current url. What I need is the value of the url the pop up originated from.
a user goes to a page, selects a value from a select box then clicks a link to run a report using that hidden variable as a parameter. I am attempting to place the value in the URL to pass it. I'm sure the javascript is working, and maybe it's the HTML I've messed up - not sure.Here is the javascript (the alert does return the correct value):
function OnChangeDay() { //assign the day id to the hidden variable $day x=eval(document.getElementById("day_loc_id_select").value)
[code]....
And here is the HTML that should send the value, but I get day= (nothing)
<a href='/depts/edoptions/excel_extract.php?ex=2&day=<? echo $test_day ?>'>SLIP Data to Excel</a>
I'm developing one application that have two iframes. These iframes are ARS forms.So, I need to transfer information from one to the other one and after that, call one save method of the ARS form. (Ps: both have the same src attribute, in other words, the same form).