I'm having a tough time trying to add the "zip" variable to my YQL statement.
var zip = $(this).attr('zip'); $.YQL("select * from rss where url='http://weather.yahooapis.com/forecastrss?p=' ' "+ zip +" ' ", function(data){ var w=data.query.results.item;
[Code].....
I've tried as many different ways as I could imagine. Simply putting the literal zip code in the query works perfect.
I've made the following script: $(document).ready(function(){ var showHide = $.cookie('menuStatus'); alert(showHide); /* Part that dosnĀ“t work. if (showHide==closed) { $("#menu").hide(); } */
$(".openClose").click( function(){ $("#menu").slideToggle("slow", function() { if ($(this).is(':hidden')) { //var state = "closed"; $.cookie('menuStatus', 'closed'); } else if ($(this).is(':visible')) { //var state = "open"; $.cookie('menuStatus', 'open'); } //alert(state); }); });
Now this is the example: [URL]. When page loads, you get an alert, with the var showHide, which should be open or closed. Problem is the if statement. I must say it was exciting to make this little script with jQuery. Especially setting the cookie, I couldn't have done it without the jQuery plugin. As you can see I tried to set a variable first but when page reloads, the variable was reset.
Is it possible to pass a variable into a if statement, What I mean is the function takes in variables i need to take one of those variable and put it in the actual statement.I need the check variable to be put in the if statement but all it does is throw an error because it can't find "check".
I have been assigned the old Pizza Form tutorial. My form asks for customer info, select size with radio button, and select toppings with checkboxes.I created a ValidateForm() function to check if these are filled in and output a message for each field saying "please fill in field."My problem now is that on Submit I need to print out a message with customer info, selected size, and selected toppings.I have the customer info done with a var message:
var message = "Name: " + name + " "; message += "Address: " + address + "
I've created a jQuery script that uses a switch statement. However, my experience with it, relative to variable scope, doesn't seem to follow the logic.According to the JavaScript/jQuery theory, a global variable was accessible (meaning read & write) throughtout any function within any script (one that page).However, apparently that theory wasn't completely true as it pertained to switch statements that contained variables. To illustrate my case in point, I've included a simplistic version of my code:
As shown, the variable "testVar" is not accessible from one case to the next case .Furthermore, to add insult to injury, I am seeing the same behavior within the conditional if else statement counterpart to the switch statement.
The first time I enter the command n it should run the first if statement, when I enter n it should then run the second one as its in zone two. However this is just not happening..
// gameFunctions.js // Javascript file for Game.html // September 29th 2010 Edition
I have an input form that accepts numbers. I am trying to compare the last field value to the current field value. My problem is that when I use the variable name of the last field in an object path, I get the error "null or not an object". The var 'L' is the problem in the statement below. If I manually type the field name in place of 'L', it works fine. How do I have to write this statement so 'L' works?
I'm trying to add a textbox to my div -- the code to add does work but when I add in the if statement to make sure that there won't be multiple inputs, the code does not work...
1. How do I debug my own scripts? I've been learning slowing but I don't know the quick way to catch an error and print to page.
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.
my webstie allows users to change the color of the background, so to keep the text readable I have it changing as well.the color picker I am using has text boxes with rgb values 0-255 for each.I am trying to get one bit of text to alternate between red and blue with the conditions
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.