I don't understand how $(this) differs from doing a normal element select ('a'). Dont they both loop and apply the attached function to each element affected?
how to accomplish this. In my website, I would like the user to input text into a single or multiple textbox(es) and then have the contents of the textbox(es) stored to either a variable or an array. Then I would like to have that variable/array compared to other arrays. Basically, the user is searching for items in a database. The user can search for as many or as little items as they want. Then the item(s) will be compared to multiple arrays to find out if what the user wants is in the database.
So for example, let's say the user is searching for recipes that have all or part of these ingredients: chicken, broccoli, lemon, honey. So, there would have been a total of 4 textboxes...one for each ingredient. These ingredients are stored to an array..lets call it ingredient(). In the database of recipes, each recipe has its own array which includes the ingredients needed to make the recipe, we'll call them tag1(), tag2(), and tag3(). Now, I want the array, ingredient(), to be compared to each of the "tag" arrays to see if any of the "tag" arrays include exactly match the ingredient() tag in part or in whole. Is this possible?
I'm trying to insert a javascript variable into a hidden input form field. Here's what it looks like:
<form name="loginForm" action="scripts/wgate/ziac_login/!?~language=EN"> <input type="hidden" name="pss" value="`G_NEW_PASSWORD.value`"> <input type="hidden" name="usr" value=""> <input type="submit" value="Please Click Here to Continue"> </form>
and then later down the page I try to reassign "usr" like this:
<script> var allcookies = document.cookie; var position = allcookies.indexOf("user="); var start = position + 5; var end = allcookies.indexOf(";", start); if (end == -1) end = allcookies.length; var valueofuser = allcookies.substring(start, end); valueofuser = unescape (valueofuser); document.write(valueofuser); document.loginForm.usr.value = valueofuser; </script>
I can see it is printing out document.write(valueofuser) correctly, so I know it is grabbing the user name. But it doesn't seem to want to insert it into the form on the next line. Any suggestions?
I've been facing a problem assigning a javascript variable to an input text's value attribute.
My code is as follows: var moduleCd = document.getElementById('client.moduleCd').value; var productSelectLen = productSelect.options.length; for(var i=0; i<productSelectLen; i++)
[Code]....
look at the bold italic marked text where I want to assign the value of variable moduleCd.
I'm using simpleCart() javascript shopping machine for my page.The script accepts values in a specific syntax:onclick="simpleCart.add('name=Some name','price=23.4','quantity=1');"But because the price of the product is not always the same but comes up after previously made calculations, i want to parse the values in simpleCart() through another function. I have made the following one which gets the price from a textbox (resultAlmires) of a form (Almires), then converts it to american format (. instead of ,) makes it have one decimal only and finally parse it to simpleCart() with the use of a variable.However it doesn't seem to work:
function addAlmiri() { var timi = document.Almires.resultAlmires.value; timi = timi.replace(/,/,".");
I have a PHP based calendar where the cells will change color depending on the number of clicks.. this all works fine, but is pointless if I can't send the outcome along in an email. I can do this with PHP but first need to get the values into a hidden field. This is what I have:
[Code]....
All I'm trying to do is populate value with either 'available', 'not available', 'working' or 'not set'... however, it is worth noting that each cell may have a different value, e.g. 1 cell might be working while the other is not available... so i need to pass the values of all the cells.
I have a PHP based calendar where the cells will change color depending on the number of clicks.. this all works fine, but is pointless if I can't send the outcome along in an email. I can do this with PHP but first need to get the values into a hidden field.This is what I have:
Code: <script type="text/javascript"> function countClicks (obj){
I'm using Keith Wood's jquery plugin to produce some graphs for my site. Though I've been able to produce "static" ones, I'd like the user to be able to input a new constant and then have my graph update it according to what they enter. I'm not quite sure how to add the value that the user inputs to my linear function below. So far I have:
I have the following bit of code:<input type="range" min="1" max="50" value="7" onchange="endingwk(this.value)" />Instead of value="7" above, I want to give it my value which is held in a variable "lastwk".How can I do this as one is HTML and the other is Javascript ?
I am trying to create a page that will pull data out of an input text box to a variable. I am then trying to take that data and punch it into a function, to eventually spit out the answer back on the web page. It has to do with telling the user to enter how many hours worked and their pay rate. I have included the code below. The problem I seem to be having is that I want to click a button to pull the data, then output the result in another script below the input boxes. I may have over done it with the functions, but what can I say..I'm lost! When I try to run it, I have the document.write cmd in there that is supposed to output the variable grossPay. Instead, it shows all the code instead of the value.
If I have something else wrong, or if I am making poor choices let me know. For some background, so far I am in the beginning stages of functions, if..else statements, so I am not trying to get crazy with this. Just something simple.
Might be a simple question, but I'm a Javascript and OOP newbie.
I have a form that I'm using Java & Ajax to dynamically validate while the user is typing (sort of, it actually executes the validate script after a 1 second pause in typing has passed). code...
Tried searching but didn't seem to find a solid solution to my problem I'm trying to pass a value to an input form field, from a function. Here is my code
PHP Code: <script> function createDiv(sceneNum, startTime, endTime, dialog, notes)
I am working on a javascript for my blackberry. I am trying to capture the latitude and longitude of that phone. I am able to get the coordinates in an alert box but am having a little trouble writing it to a form input field.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "[URL]"> <html xmlns="[URL]" xml:lang="en" lang="en"> <head><title>GPS Testing</title> </head><body> <script type="text/javascript"> if(blackberry.location.GPSSupported){ document.write("Your device supports GPS locating"); blackberry.location.onLocationUpdate(window.alert("Latitude: " + blackberry.location.latitude + " Longitude: " + blackberry.location.longitude)); var lat = blackberry.location.latitude(); var lng = blackberry.location.longitude(); blackberry.location.refreshLocation(); document.write(lat); } </script></body></html>
I am only able to test with Blackberry. I was trying to create a couple of variables with the "var lat =" and var lng =". With this script I get the alert window and when I click ok it writes "Your device supports ...".
I need to get a piece of code that will allow me to have a user input a number, say 1-200 and that variable would make up the last part of an IP Address that the user wants to browse to.
I have the following html, field xxx requires a number from 0 to 100 when percentage is selected, and 0 to inifinity when dollar is selected.what's the best practice to setup validation for this?the key is to control the maximum value.I have tried depends expression in a max rule, but it doesn't seem that it can satisfy my requirement.
Let me preface this with the usual disclaimer: I am new to this and have only been programming with Javascript, PHP for about 2 weeks now and have been lucky enough to have resolved the issues I have encountered. This one however is puzzling to me.
I have a HTML form created that collects member information. It calls, on submit, a confirmation page that lists all the data fields entered. This all works great. However, when I then post the variables from the first html form page from my second confirmation html page to my PHP script, using document.write with input type=hidden and inserting the address variable into the value field, the Javascript only passes this variable up to the first space. It is the only variable I pass that has a space in it.
I have verified that the variable does indeed contain the whole address and I have also verified when I execute the following: document.write ('<input type="hidden" name="address1" value='+address_1+'>');
the address_1 parameter passed to the php script only passes the string up to the first space.
I even tried to put fixed text in there instead of a variable (e.g.)
I am trying to declare a variable inside a function and use it later on in my code... but it just already returns white space... i.e. not variable value. I am setting it within this function:
function show_video1(){ document.getElementById('video1').style.display="block"; var video1Name = "Education World News (Part 1)"; document.getElementById('video2').style.display="none"; document.getElementById('video3').style.display="none"; document.getElementById('video4').style.display="none"; [Code]...
and trying to call it later on with this: <script type="text/javascript">document.write(video1Name)</script> It might be worth noting that each one of my 11 videos will hace a different name.