Switchh Statement Isn't Working?
Jun 18, 2011why my switchh statement isn't working?
var rehash = inward.location.hash.match(/[^#]/);
switch(rehash)
{[code]......
why my switchh statement isn't working?
var rehash = inward.location.hash.match(/[^#]/);
switch(rehash)
{[code]......
I've got the following code block in one of my pages ...
<?php
if ($config->theme->short_name == 'default')
{
?>
<script type="text/javascript">
[Code]...
Shouldn't the code above set the .html property of the element with class "error_box" to the specified text? I've tried using an id instead of a class i.e. $('#error_box").html(...) but that doesn't work either. I've also tried using the .text() method.
Manually using document.getElementById("error_box") works without any problems - it's only jQuery that won't do what I tell it. :-)
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]....
<div id="mush" style="position:absolute;top:80px;left:1500px;width:200px;height:10px;background-color:black;" onmouseover="tim();"> <p>MUSHcode</p> </div>
<script type='text/javascript'>
var div;
var ts;
var te;
[Code]....
The script just stops working completely when the if, then statements is in there. The div's original height is 10, so it should work, because it only issues void(0) if the height is not 10.
Why my page is not redirecting within the if then statement.
Here is the code:
I have tried this without the if then statement and it works fine. I am not sure why my if then statement will not work within success function, am I doing something wrong?
I've got an annoying non-working bit of code:
<div id ="messageDiv" style="display:block;">No profile information entered yet</div>
<script type="text/javascript">
function profileInfo() {
var m1 = document.getElementById("marital1").innerHTML.toLowerCase();
var b1 = document.getElementById("bodytype1").innerHTML.toLowerCase();
[Code]...
The first part up to before the 'else if' works. but if the 'w1' has [URL] it still doesnt return true and display the DIV block??
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]....
I'm trying to make a very simple image slider. For this I'm using a div which contains all the images next to each other, which is wrapped into a container div with an overflow:hidden. With a "previous" and "next" button I want to animate the margin-left property of the div which contains the images.
This is all working ok, but I want the div to reset back to it's original position when the last image has been reached and the user clicks on "next" again.
The width of one image is 500px, therefor I'm changing the margin-left with 500px each time. This is the code I'm using for that [code]...
Again, this is working fine. But when I wrap an if statement around the function, I cannot seem to get it to work the way I want[code]...
I was trying to make a javascript code that password-protects a web page without showing the actual password in the code. so I came up with this:
var p1=prompt("Password number 1");
var p2=prompt("Password number 2");
var p3=(p1*p2);
[Code]....
The idea is that you come up with two large prime numbers (the passwords), -in this case I used 18313 and 22307- that aren't shown in the script. Once the user imputes the numbers, they are then multiplied, and the product (in this case, 408508091) is then used to gain access. So if someone else wants access but doesn't have the passwords but has access to the code, they'll need to deduce the two prime numbers from the one larger number. It won't stop them completely but it should hold them off. (I know there are easier way's to password protect a web page so you don't need to remind me)
OK, now that I'm done blabbering here's the problem, the else statement isn't working. no matter what I do it always grants access no matter if the passwords are correct or not.
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.
Any ideas what is right or wrong in this case?
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?
What is the correct construct for accessing "pageYOffset" in another window?
I've tried this, but it doesn't work:
var mainPageYOffset;
//
mainPageYOffset = parent.main.window.pageYOffset;
It's been a while since I've worked with javascript time comparison,
and I was wondering how I can say "if time < 15:30"?
The semicolon looks out of place to me, and indeed it has caused an
error.
I remember using if statements with null in it. For example, at one
point I used this:
if (value == null) {
value = "something";
}
document.write(value)
However, this script causes an error in any browser. Why can't it
correct the value like it should?
For the following two snippets, they can all pass Firefox.However, I would like to know the rule of thumb when I have to use ; to indicate the end of
[Code]...
I have a two fold question:1) Why would my while statement not be workingI have cleaned up my code a little (although not perfect) but my while statement is not behaving, it does not output any numbers on a console.debug (using google chrome, or any other browser for that matter) which from my understanding it should?and 2) Slightly out of the remit of this forum I suppose, but this code is quite lengthy and I know there are ways to make this more efficient I just dont know what they are?
function generatePurchaseFields(dom) {
new Ajax.Request('/control/?page=tldmaxyears&domain=' + dom, {
method: 'get',
[code]....
This is my first time using the switch statement. I would appreciate your suggestion on how to do this properly. I am trying to get customer age which is (age) and compare it with the monthly rate then the text msg will display in the textarea. Also, I am having trouble figuring out how I can defined my monthlyRate in the switch or do I need to this outside of the switch? Code:
}
i have the following:
a1="asdf"
how can i check in an if statement whether contains a numeric only value and if not then alert.
What is the purpose of with statement in JS?
View 3 Replies View RelatedI am trying to test the id of three input boxes so that I can capitalize the first letter.
The fname and lname work fine but mi does nothing and I get no error is this because of the if statement or the fact that the mi only has one character?
I need to give two separate alerts depending on what the user clicks when they click the "Submit" button. I am using a confirm box. If they click "OK" it thanks them for their order. If they click "Cancel" it should go back to the form. I have written the code that I thought would work but it will not.
function confMsg(){
var s
s = confirm("Click OK to Submit Order. Click Cancel to Cancel")
if (s=="true"){
alert("Thank You for Your Order!")
else
return;
}}
I am working on a script that calculates the rental rate for a property. I currently have this code and form, which works as I wish it to.
Code:
<script type="text/javascript">
function roundCents(amount) {
[code]....
I would like to make the following statement clearner. I'm thinking something like the SQL "variable IN (value1, value2, value2, etc.)" operator.
Code JavaScript:
if((e.which > 47 && e.which < 58) || (e.which > 95 && e.which < 106) || e.which==8 || e.which == 46 || e.which == 37 || e.which == 39 || e.which == 13) return e.which;
How can I get the result for the following SQL statement using JavaScript?
SELECT branch, region, referral, COUNT(DISTINCT LPS) FROM table GROUP BY branch, region, referral
Data:
BranchClientReferral TypeLPS #
402036402430Psychological File Review30
402036402430Psychological File Review50
[code]...
document.write("<img src=' "+r_image[rand_int]+" '>");
could it not be just written like this:
document.write("<img src='r_image[rand_int]' />");
I have an html form that calculates a square footage (length x width)
Code:
<center>
<form name="frmOne">
[code]....