I need the page to redirect if x is null AND the screen width is less then 600. My problem is the page is still redirecting even if the cookie has a value.
To make sure my cookie was working properly I just tested an alert of x and it gave x's value.
Code:
<script type="text/javascript">
var x = readCookie('mobile')
if (x==null && screen.width < 600); {
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've been using jQuery for a while now but I never needed to write something from scratch up until now. Is it possible to use some if statements to replace (replaceWith()) a form depending on which of the inputs was activated? The objective is to design a quick survey tool with different forthcoming questions, depending on the ones given.
when the visitor wants to register on my site, they have to fill in there email address in the requiered field and then check the terms box to activate the register button...thats all good, but there seems to be a bit of a bug......it seems that when they fill in the email address and press return, it skips passed the terms box and goes straight to the register page...
I have a javascript which verifies if the submitted data is a number or not, and works like a charm, but... I also want to be able to tell if the number is "0" and then submit other data.
Here is my script: Code: // Makes sure variable is a number function validNum(nmbr){ // forces variable into integer type nmbr = (nmbr * 1);
// Checks if variable is Not a Number if(!isNaN(nmbr)) // If a number, return value return nmbr; else // If not a number, return zero return 11; } Now, what I want is to add "0" as not a number and change that to "11" as the last else...
I am trying to hide div based on conditions..This is the scenario: the div should never appear again for that user, until i write another server side message.lets say i write a message today saying " we are really sorry, but the website will be don for one hour today" and you login today, the message will be displayed, when you click close its closed,it wont appear again for you, until i post another message,but each message would have an expiration date, if i post a message which would be displayed to every user, i should decide how long i want it displayed, maybe 24 hrs, so in 24 hrs the message should no longer display.
I have implemnt a onBlur event of a text input. In the event, a window with all records which related to the text input will be shown. However, I don't want to pop up the window in case there is no records that matching the text input.
I have been building a website and am in the process of integrating a shopping cart into the website. I have colors for the products in a <select> but there are a few colors that require an extra processing step that would cost extra to the customer if they chose those colors. However I don't want that extra processing step to be visible unless those certain colors are selected because I feel it would be confusing to the customers.
I have the following code. What I want to do is for certain questions to remain hidden inless certain conditions are met, then they appear to be answered. I am thinking with the <div> but not sure how. I also thought maybe with css but cant write a if statement in css so that a no go.
<tr><td align="left">Do you own a Yorkie?<br /> <input type="radio" name="owner" value="yes" /> Yes <input type="radio" name="owner" value="no" checked="checked" /> No<br />
Now, the problem is. when i click the link. nothing happens. :| the way i want it to be is, when you click the link, the list shows. what's wrong with it?
Function doesn't work with conditions , but works without them , I need a condition in the function so i can pause, start a slideShow. how do i do this.
The following javascript coding is used in a "select a city" dropbox.
I made a submit button. I want the button to redirect the page to "page1.html". "page1.html" will be a webpage with events located in Auburn, Alabama, United States.
My submit button:
Here is my function:
Right now my button doesn't recognize if i select "Auburn", so it never sends me to "page1.html". Can someone please help me write the correct if statement?
I'm got an application that uses (will use) 6 drop down boxes to filter through items stored in an array, if I can get a search system sorted out.At the minute i've tried a range of ways and I can't suss this out. At the minute its counting the number of entries that match the filter criteria but its not even getting that 100% right.I've tried using one big if statment 'if condition 1 && condition 2 && condition3 = true then' etc. I've tried nested ifs. t the moment I thought I'd try to dump the values of servos into a new array, that meet the criteia of the first if, then using another if, create another array and repeat this until only the servos that meet all 6 if conditions are stored inside one array that i can then set to display on screen. if there are no matches then i can display a 'none found' messageHeres my code, hopefully its commented enough to follow whats happening,
I want my submit button to link to different pages, based on the value of a particular variable (let's call it total).
So, if 18 < total < 20, the submit button should redirect to page1.html If 16 < total < 18, the submit button should redirect to page2.html If 14 < total < 16, the submit button should redirect to page3.html
I have created page1.html, page2.html....page10.html. how should I link my submit button (I have only *one* submit button) to different pages based on different conditions?
I am trying to make a carousel of sorts. I am kind of stuck with hiding and displaying the next and precious buttons once a div moves to the far left and right of its container. I think i have everything correct regarding calculating the widths but for some reason when you click the buttons, elements stay hidden irrespective of the conditional comments which should dictate when they should be hidden or shown. Here is a link to what i have thus far. Click the MoveLeft and MoveRight buttons. [URL]
Can't get this to work correctly. I need to run an alert if the user clicks the button "#step0Next" and none of the var ckd button's are checked [code]...
In my website I have a couple of forms that you can only see them if certain conditions are applied.
For example - if you're an admin and you search a user, you'll see a form which allows you to edit his information. if you're not you won't see it. if you're already logged in you can't see the registration form, but if you aren't you can.
So I did it with ASP in this way - (this is the registration part)
I've managed to put in the form inside the Response.Write(), and it also has the javascript part like this -
This works perfectly fine.
Now, I've done this twice. the example above is from the registration part which doesn't allow a logged in user to register again.
I'm having problems with the second one - not showing the edit form to a user who can't edit.
This is basically the code -
Now this doesn't do anything... the submit button just ignores the JS file and just submits the form the way it is, unlike the other form which is written pretty much in the same way except for other JS fields/text boxes.
I know the code is written really poorly but thats unfortunately what we've been taught in class and thats all I know.
- I'm not checking for nulls because if a field is empty it means the information won't be edited.
I am reading the ECMAScript specs trying to figure out if the next line is a legal statement or not new Foo();
I think the above code may only be legal as an expression and not as a stand alone statement. Would this make the above a bug?
Douglas Crockford's JSLint will choke on the above line of code and stop parsing. All the browsers seem to accept it as ok and work as I expect: the returned object just doesn't get assigned to anything.
The time I have used a line like the above is when the constructor has side effects and the "class" keeps track of all its instances.
I have several text fields on page that I would like to make calculations based on if there is a number input in one of the fields. So, if the price field is populated, the sale price field would populate using a function to do the calculation.
Now, how do I write the code for this to occur? I know how to get the function to fire based on clicking a submit button, but not sure how to do it simply based on a number keyed into the one field. Is this possible and if so, how?