I just have some fields for people to enter the number of tickets they want in four categories. This number of tickets in each category (member, nonmember, etc.) is multiplied by the ticket cost, which is being pulled out of a database, and then the total of the four categories is meant to be added up.
I have checked that the database values are correct and they are displaying. In fact, the script works fine when it operates just on any one input field - multiplies correctly and returns the right result.
The problem seems to come up whe I try to add the four input box totals after multiplying them by the ticket price. It gives me 'NaN' in the output field. Here's the script i'm using: Code:
I have a form that I am trying to loop through the elements of and come up with a total, when the form is submitted. The goal is to alert users that they have not entered a minimum or maximum number of choices before letting the form submit. The fields in question might be checkboxes in some cases (with a value of 1) or textboxes in others with user-submitted values. Here is a stripped down example...The html
and what I want to end up is with an array with the sum of the [0], [1] and [2] values, so for instance with this example, I want an array returned like this:
[50, 60, 52] i.e. this is [(32+8+10), (13+17+30), (26+4+22)]
My real problem with this is that the "inner array" can be any number of (its dynamic), so in my example its just 3 values but it could be for example 5 values e.g.:
I have some JavaScript which is splitting out the different variable elements from the URL.Now, how do I set the internal variables?Then I want to set the variable ScriptHeading to be Change and the variable ScriptType to be NewThread.I keep finding all sorts of lovely code showing how to split out the various sections in many different ways, but I can't find anything on how to actually set these variables.
I have a program written in Javascript and fully functioning which takes a user-selected directory name and then displays all the photos in that directory in a certain format.
I am now wanting to expand the program to allow users to optionally enter their own strings and the program will use all the photos from www.flickr.com which use that string as a tag.
I have a PHP interface to flickr (called PHPflickr) which collects all the relevant photo urls. I now need to get these images back into my Javascript so I can process them using the existing functions (rather than rewrite all my functions in PHP code and have two sets of functions in the program). I found on another thread a means to do this for a date variable:
but being completely new to PHP I'm not sure what "addslashes" might be or what formatting will be necessary if I am starting with an array of urls. Code:
How can I then use this variable to access the opener of 'window' ?
Meaning, I dont want to access it as such:
window.opener
but as: window.+newVariable
So it uses the contents of newVariable to access the opener.
I need this because I have a couple of variables which I need to concat to eachother as a string, and this string in turn is the variable I need to access from window.opener.varSomething where varSomething is the variable that stores the variable I need to access.
I use ASP to obtain data from a database and I have a piece of javascript code I use on my website. I want to use the database variables in my javascript. I'm not very familiar with javascript, but here is some info similar to what I'm trying to do.
Not sure if php is the best solution or maybe javascript. ( or both.)
I am writing a litle script that will go to my mysql table and take out 20 rows ( from about 10,000 rows ) based on the WHERE statement.
Then I want to step through these 20 rows displaying just two filds in this fashion:
First, I want to display one field in a "box" ( using divs and css ) then wait for a form input. Then while keeping the first displayed box and field display the second field in a similar box a fee lines below. Wait for a form input update some data.
Then onto the next row.
If I use javascript then I could keep all the processing on one page and not have to have server refreshes.
But how do I get these those array elements from $row['field1'] and $row['field2'] into javascript vars ?
Is this the best way to do this ?
Or would php and having a couple of extra trips to the server for form processing be better ?
I would like to multiply combo_1 and combo_2 to give an outcome and display it in the textbox of txt_price using javascript. f['txt_price'].value = (f['combo_1'].value).toFixed(2);
This is something I was working on but no results so far. <form> <select name="combo0" id="combo_0" onChange="change(this);" style="width:200px;"> <option value="0">-select-</option> <option value="1">Canada</option> <option value="2">States</option> </select><BR><BR>
<!-- I would like to Multiply this field --> <select name="combo1" id="combo_1" onChange="change(this)" style="width:200px;"> <option value="1"></option> </select><label></label> <BR><BR> <!-- and this field --> <select name="combo2" id="combo_2" onChange="change(this);" style="width:200px;"> <option value="1"></option> </select> <BR><br> <!-- To present an outcome to this field --> <input type="text" name="txtPrice" id="txt_price" onChange="change(this);" style="width:200px;"> <BR></form>
I need to create a variable out of nothing. From a database I extract an item with a certain id. With this id I want to create a new variable. For example:
id = 36;
"item"+id = new Array();
Now I get the message "Illegal left hand assignment".
I tried:
eval("item"+id) = new Array();
Is it possible to create a variable out of nothing?
I need a javascript that will display all system variables (e.g. HTTP_REFERER). I am not a programmer, so if you could post all of the html and stuff that would be great. Code:
how you would piece together a variable name and then assign it a value. I want to create a hidden field and assign it a value based on the value of another variable
Can I have 2 variables upon one select? The code below is created dynamically with php from a database, and displays a dropdown select box, the only thing is that the values: Oliver Franchis, Pedro pastor, Maria China... have unique ID's and when the name is selected I would like the ID allso to be.
<!-- Populate list with friends START--> var newTextbox = document.createElement('select'); newTextbox.className = 'fn-select'; newTextbox.name = "opcion";
//First user in the populated select menu is the person Loged in var op1 = new Option("", "Oliver Franchis"); newTextbox.appendChild(op1); var txt1 = document.createTextNode('Me | Oliver Franchis'); op1.appendChild(txt1);
//Next users are my friends in the database var op1 = new Option("", "Pedro pastor"); newTextbox.appendChild(op1); var txt1 = document.createTextNode('Pedro pastor'); op1.appendChild(txt1); .....