Adding IF Statement To Variable Message?

Oct 22, 2010

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 + "

[code]...

View 3 Replies


ADVERTISEMENT

Adding A Simple If / Then Statement

Feb 12, 2010

I have a script that loads various SWFs into a div called flashBox using a function called loadSWF whick I'm calling from different span tags.The project is a for a tutorial, which loads a different animation into flashBox for each step.My problem is this: If I take my mouse off of a step, even if I don't mouse-over a different step, the SWF gets reloaded from the beginning.What I'd like to do is append the following script with an if/then statement that looks at the current SWF in the box, and if the file is the same one as is being send from loadSWF as the "url variable, do nothing.The site is located here, in case you're not following me: URL...So if you take your mouse off a step and then put it back on, the SWF gets re-loaded. I want that to stop.[code]

View 6 Replies View Related

Adding Input To Div On Click With If Statement?

Nov 27, 2011

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.

2. Is there something I'm missing with this code?

if(!document.getElementById(post_id.id).innerHTML.indexOf('post_rep_box')) document.getElementById(post_id.id).innerHTML += "<input type='text' name='post_rep_box'/>"

I've also tried (post_id.id).value

View 2 Replies View Related

JQuery :: Adding Event For HTML Statement

Nov 20, 2011

I am using a dialog box plugin. I need to add a button so I use html statement like below:
'<input id="myButton" type="button" value="test" />'
This renders just fine but I don't know how add an event for the button or even add this button to the DOM.

View 1 Replies View Related

Jquery :: Validate Plugin - Adding A Promotional Message On Submission?

Jul 16, 2009

I want to display a promotional message when the user clicks the submit button and before it goes to the server. The user must meet certain criteria in order to do this which is their postcode and I have written a regex for this -

/[TA]{2}[1-18|22|24]{2}/ I'm not sure how to incorporate this into my script. I have this so far.

[Code]...

View 3 Replies View Related

JQuery :: Applying Variable To If Statement?

Jun 17, 2010

Need to apply a var to a statement if its conditions are met, this syntax isn't throwing errors but its not working.

<script type="text/javascript">
$(document).ready(function(){
var action_is_post = false;
//stuff here

[Code].....

should I use something other than .ready? I need it to apply the var when #stepDesc0 has the class current.

View 9 Replies View Related

JQuery :: Passing Variable Into YQL Statement?

Apr 17, 2011

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.

View 2 Replies View Related

Pass A Variable Into Actual If Statement

Mar 10, 2009

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".

View 4 Replies View Related

Jquery :: Input A Variable In If Statement?

Dec 1, 2010

Below is a working code.

1. if($('input[name="test"]').is(":checked"))
2. {
3. // my other code
4. }

I want to remove "test" and put a variable there instead

I tried this way but it does not seem to work.

1. newData="test";
2. if($('input[name=$(newData)]').is(":checked"))
3. {
4. // my other code
5. }

View 3 Replies View Related

Using The Switch Statement And Variable Scope?

Jun 14, 2010

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:

$("#selector").delegate("div", "click", function(event) {
var testVar = 4;
switch (this.id) {

[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.

View 1 Replies View Related

If Else Statement Not Working With Global Variable

Oct 13, 2010

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

[Code]....

View 2 Replies View Related

JQuery :: If Statement - How To Set Variable First When Page Reloads

Jul 1, 2010

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.

View 2 Replies View Related

Variable Doesn't Work In An Object Statement

Feb 19, 2010

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?

Problem statement:

c=window.document.save_info.L.value;

Here is my code: Form element:

Code:

<input style="border:1px solid gray; background-color: #FF9;" onkeyup="moveOnTwo('frm_score1',<?PHP echo $num_holes; ?>,this,'frm_score2')" size="1" maxlength="3" name="frm_adjsc1" id="frm_adjsc1" />

JavaScript Function:

Code:

function moveOnTwo(lastFieldID,holes,field,nextFieldID){
var L = lastFieldID ; var N = nextFieldID;

[code]...

View 3 Replies View Related

Adding "loading" Message To Gallery?

Nov 17, 2011

My site gallery loads everything before it appears, and sometimes it can take a while. So I want to add a "loading..." message of some kind. I only want it to show once during the original load, not for each image. Here's a link to the gallery:

[URL]

View 2 Replies View Related

Adding A Variable To A URL

Jul 24, 2007

I have been working on a script to integrate into my firefox addon that i'm working on. I'm trying to utilize nwtools website which has a lot of network tools whois/trace/dns lookup etc..

I'm currently working on the whois portion. As you can see below, I am trying to make a function that will pass a variable to the ending of the URL. In this case it would be cnn.com.

View 4 Replies View Related

Adding A Variable To A URL?

Mar 31, 2011

I am adding a feedburner url into an html page, but need to make it so you can increase the amount of posts you want to see. Ex. The default amount of posts on the page starts at three, but then I would have a button called more where you would click it to view say 3 more, and then if you clicked it again 3 more, ect.This button would have to call a javascript function correct?

<script type="text/javascript">
var i=3;
function more()

[code]...

The nItems declares how many posts are on the page, so I would want it to equal a variable that can be changed via the button. Also if someone knows how to add ajax so you don't have to refresh the page, that would be a nice extra.

View 4 Replies View Related

JQuery :: Adding A Variable

Sep 8, 2011

This is a bit longwinded, bear with me, I'm thinking it through. Here's the html structure:

<p class="a1">this text</p>
<p class="b1">that text</p>
<p class="a2">this text</p>
<p class="b2">that text</p>
<p class="a3">this text</p>
<p class="b3">that text</p>...and more like these.

the objective: if the p class name starts with "a", append <span class="add"> A</span> if it starts with "b", append <span class="add"> B</span>

[Code]....

View 6 Replies View Related

JQuery :: Adding Variable To Selector Id?

Dec 10, 2010

Basically I have a carousel, and when an item is hovered on, it's corresponding titles needs to show up below. I've managed to get a very inefficient version this working by repeating the function with the explicit id for the list item, but I'd like to get this working in a more automated fashion by assigning a variable that can be used with both the list item id and the paragraph id. I'm not sure if index() is the best way to go about this, or how to actually add the variable to the id's.

The HTML --
<div id="carousel_holder">
<ul id="carousel">

[code]....

View 1 Replies View Related

Adding A Variable To Url When Page Loads -only Once!

Mar 8, 2006

This is for an ASP submission form. User creates a record, Access assigns a unique ID by Autonumber, I want to then pull that ID and insert into URL.

This is my code:

var addID
addID = '<%=(rsResults.Fields.Item("ID").Value)%>'

location.href=('?ID='+addID);

It adds the ID to my url fine, but it doesn't stop!
I've tried making a loop by this method:

var addID, looper;
looper=1;
while (looper < 2) {
addID = '<%=(rsTestResults.Fields.Item("ID").Value)%>'
looper=2;
location.href='results.asp?ID='+addID;

}

View 1 Replies View Related

Adding Alert Feature With PHP Variable?

Mar 25, 2010

I am pretty new to javascript, I've made a php game and I am adding the last touches. Ive got. When I press m it goes to your mailbox. Now what I want is the alert feature. Now I have that. I want it to say. You have COUNT new message(s). How do I get my php variable into that javascript.

View 1 Replies View Related

Adding A Variable To A Pre-existing Script

Mar 6, 2005

The script below is configured as an onmouseover & out fad-in url script. It's been configured it so that the fading of links only occurs in areas with the class name "fade". My first and simplest request is that someone has a quick look and changes the code from class name "fade" to class name "descriptions". i would do it myself but the word fade is also used for other variable names within the script (etc) and i'm not 100% sure which names to change and which to leave

The second aspect I need help with may be somewhat more challenging.
The script currently fades the TEXT of the link from one color to another. I need it to fade something else. luckily i think the modifications to the script might not neet to be that extensive. Here's what I need.

Instead of the color of the text fading in & out, i need the color of the boder to fade in & out. Here's an example:
i need the properties of the link to go from
text-decoration:none; border-bottom:1px solid FFFFFF;
to finish at
text-decoration:none; border-bottom:1px solid FFB903;

the only change is the color... so i figure all we need to do is create a color variable and place it in the code, like so:
text-decoration:none; border-bottom: &#391;px solid' + 'color'
and then simply have that color variable increment using the startColor and endColor variables found below Code:

View 16 Replies View Related

JQuery :: Adding Element HTML To Variable?

Jul 11, 2011

I'm trying to create a function which shows a hidden response when a button is clicked on.I also want to add the response to a variable which lists all the users responses.Here is my code now...

$(".yes").click(function () {var feedback = feedback + $(this).html();
$(this).parent().next("p").show("fast"); });
$(".no").click(function () { $(this).parent().next("p").next("p").show("fast"); });
$("#email").click(function () { alert(feedback) });

The bolded line is the part which isn't working.

View 2 Replies View Related

JQuery :: Adding $(this).html To A Variable Not Working?

Jul 12, 2011

$(function() {
window.resizeTo(925,10000);
$('input').removeAttr('checked')

var feedback = "Your Results: ";
$(".yes").click(function () {var feedback = feedback + $(this).html();
$(this).parent().next("p").show("fast"); });
$(".no").click(function () { $(this).parent().next("p").next("p").show("fast"); });

[Code]...

View 3 Replies View Related

JQuery :: Adding A Click Event To A Variable?

Apr 23, 2010

I have a setting where I construct an image reference which I then append somewhere in the DOM, like so for instance:

var one = "<img src = "test.jpg" ";
var two = "/>";
var my_img = one + two;

and then I add it to DOM using after() function. It works fine. However, I also need to add a click event to it. I tried to do this:

my_img.click(function(){
});

and then append it using after(), but it doesn't seem to work. One thing I can think of is append it after a certain ID, then look for it as a child of that ID and add click to it this way. I haven't tried this, but it'll probably work.

View 1 Replies View Related

Button Passwords - Adding Number To Variable

Dec 18, 2009

I want to create a script where when you hit a button it adds a number to a variable and when you click another button it shows you the amount you have so far. Also I am having trouble with the clear() function where it was suppose to clear the variable. When my var is equal to a certain number (not there yet) I want it to goto another page (I can do this on my own).

Here is my code
<html><head>
<title> Buttons</title>
<body style="background-color:#000000">
<center>
<p style="Font-Family:Curlz MT;color: #CC3333;Font-size:40px;">Click the buttons to test my script
</p></center>
<script type="text/javascript">
var x = 0;
blue
function mouseOver() {
document.getElementById("b1").src ="Hi_h.png";
} function mouseOut() { .....
(The button are images so you want be able to see them if you don't download them).

View 5 Replies View Related

If Statement Returning False On A True Statement?

Apr 4, 2011

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

Code:
if(blue>green && blue>red)
{

[code]....

View 2 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved