Variable Returns Correctly In FF - Incorrect In Chrome

Dec 22, 2011

I have a global variable that I change depending on what's going on in screen.

And that function changes that variable.

For some reason, in FF, it modifies the variable as expected. But in Chrome, it doesn't.

Why is this? Is there any way to have consistent behaviour in both browsers?

In fact:

Returns true in FF, but false in Chrome...

View 4 Replies


ADVERTISEMENT

JQuery :: Offset() Returns Incorrect Values In IPad?

Apr 18, 2010

I think the offset() function returns node's position relative to document. The attached html file prints the offset value to console when the box is clicked. I expect the same value would be printed every times. However, when the script is run on iPad (with simulator), it print different value when I zoom and scroll to different position. This problem does not occurred in iPhone.

Attachments
test.html.gz
Size : 388 Bytes
Download : 505

View 9 Replies View Related

FireFox Returns Incorrect Index From Onmouseover Event

Apr 28, 2011

I have a list of links to PDF articles, each link has a corresponding div that contains an introduction to the article. I'm using the onmouseover event in each link to show the corresponding introduction div and hide all the others.

The order and number of the pdf links and the introductory divs are the same. The code below works in IE but not in FireFox - the problem in FF is the index returned from the onmouseover event is double what it should be, so the first PDF link shows the second div, the second PDF link shows the fourth div ect.

javascript:

Code:

css:

HTML Code:

html:

HTML Code:

View 7 Replies View Related

PHP - AJAX And Session Variable In The Process.php Page Is Incorrect

Oct 31, 2011

I have the following few snippets of code:

JS:
Code:
$(function() {
$('.delCatButton').live('click', function(e) {
e.preventDefault();
var cat_name = this.title;
var delCatFormID = $("#delCatFormID").val();
[Code]...

The $_SESSION['delCatFormID'] variable in the process.php page is incorrect, and never equals the posted variable.

View 3 Replies View Related

JQuery :: Chrome & Safari - Not Answering InArray Correctly?

Jun 25, 2010

I'm using inArray() to check an XML tag against an array called status[]. If the result != -1, then do one set of instructions, else, the item is 'available' so do another set of instructions. Each entry of my XML document has a <status> tag, which will contain one of 3 values, or a 4th option 'available'. I have an array setup called status['sold', 'pending', 'reduced']. If the <status>.text() is one of these 3 values, then we'll get the array position, if it's 'available' we should get -1.

When I run this in Firefox (3.6) & IE (8.0 or Comp Mode) it works fine. However, when I run this in Safari (4 or 5) & Chrome, it returns the value -1 for each of the entries. The 3rd, 5th, & 7th entries are all set to <status> 'sold' and inArray() should be returning a 0.

[Code]...

View 3 Replies View Related

Declare A Variable Inside A Function - Returns White Space - Not Variable Value

Aug 17, 2010

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.

View 13 Replies View Related

JQuery :: Ajax Returns Data On Ie Safari And Chrome But Not Firefox / Sort It?

Apr 13, 2009

Can somebody take a look at this...

The white my notes section on the bottom left is a div area that is loaded with an Jquery Ajax call just like 2 other areas on the page. This works fine in IE, Safari (PC), Chrome but not in Firefox. It just shows blank white.

View 1 Replies View Related

Variable Not Defined - Or Var Not Added Correctly?

Jul 4, 2011

I've been writing a new layout for part of my web page.

The java script is not creating the list. When I check Firebug I get an error:

QuoteMovies[movctr] is undefined [Break On This Error] MovieList+= Movies[movctr][2]

If I take out the var MovieList and just have it print the text "MovieList" instead of the contents of MovieList the code tries to run. I'm not sure why it won't copy the content of the var MovieList.

Live test version of my movie page

Here is my code:

It's also weird that is says that Movie[] is undefined instead of Movie[][].

View 11 Replies View Related

Alphanumeric Variable Doesn't Appear In Alert Correctly?

Nov 27, 2011

I'm working on a script that will take the selected div and add an input to it.

If the div id="3" then when I alert it it works right but if the div id="post_3" then I get an alert of "object HTMLdivElement"

The javascript is simple(so far)

function create_reply_input(post_id){
alert(post_id);
}

And here's the php i'm using to populate the page with the posts

<li><a href='javascript:create_reply_input(post_$div_id);'>Reply</a></li>

View 1 Replies View Related

AddEventListener Not Passing Function Variable Correctly?

Dec 11, 2010

Every time i click on one of the said elements, it puts "undefined" into the textbox each time i click on an element.it seems to me that the Key_Table[x] is not getting passed correctly. How do i make sure that this is getting passed correctly?Here's my Code:

<script type='text/javascript'>
// Startup Script
if (document.addEventListener) {

[code].....

View 4 Replies View Related

Accessing Width Variable - Returns Undefined

Feb 13, 2009

I am trying to access the width variable from my main page. Within the imageinfo.js script functions I can alert() the width value which returns 1024. But I can't seem to pass this variable to my main page or access it directly so that I can use document.write() to write the variable on the page. Whenever I try to call the 'width' variable directly from the main page I get undefined. How can I access this variable? However, with the test code below, I was able to get ducument.write() to write the 'width' variable on the page but now the page doesn't stop loading - there's an endless loop in the code...

Code:
BinaryAjax(url,function(http) {findEXIFinJPEG(http.binaryResponse);test(width)},null,useRange ? [0, Range] : null);

Main page
Code:
<html>
<head>
<script>
function test(width){
document.write('Image Width = ' + width)
} </script>

<script type="text/javascript" src="binaryajax.js"></script>
<script type="text/javascript" src="imageinfo.js"></script>
</head>
<body>
<script type="text/javascript">readFileData('image.jpg')</script>
</body>
</html>

Imageinfo script - This script uses the binaryajax script found below.
Code:
/*
* ImageInfo 0.1.2 - A JavaScript library for reading image metadata.
* Copyright (c) 2008 Jacob Seidelin
*/ .....

View 22 Replies View Related

JQuery :: Passing Variable To String Function Correctly

Aug 10, 2010

Two objects on an html page. An event on object 1 effects object 2
$(".video_rg").mouseover(function(event){
var myTriggerId = event.target.id;
var myTargetId = 'video_' + myTriggerId;
document.getElementById(myTargetId).src = 'images/test_object_2.gif'; // this works
// $('#myTargetId').src = 'images/test_object_2.gif'; // this does not
});
My assumption (we know about those) is that I am not passing the data to the $() function correctly, that it is reading '#myTargetId' as a string, and not a variable. I just really want the JQuery code that would do what the document.getElementById code is doing.

View 2 Replies View Related

Iframe - Loads A Page With Variable Contents - OffsetHeight Returns The Height Of The Document Body

Sep 21, 2010

I've got an IFRAME it loads a page with variable contents. I need to know the WIDTH of the body of that page. I'm using offsetWidth and offsetHeight

Quote:

This is weird....offsetHeight returns the height of the document body. offsetWidth returns the width of the iframe!

View 2 Replies View Related

JQuery :: Validate: Regex That Returns True Elsewhere Returns False Inside Validator Method

Oct 8, 2009

Either I'm having a really dim Friday, or something strange is going on. I'm trying to add a method to the Validator plugin, using the following regex:

[Code]....

View 1 Replies View Related

Variable Undefined In IE / FF 0 Works Fine In Chrome

Mar 7, 2011

I am pretty new to Javascript having a bit of a problem with a website with Google Maps integrated. URL I have two checkboxes (ccCheck and caccCheck). The basis is when the box is ticked, it overlays a KML onto the map. This is working fine in Chrome, but in FF and IE it doesn't work, IE returns 'ccCheck is Undefined'. The code I am using is in the JS file, the bit it gets stuck at is as follows:

[Code]...

If I stick a ccCheck = document.getElementById('ccCheck') within the onclick function (before the if statement), it places the overlay onto the map, but then when I untick the box it just stays there. It's such a simple thing (I think), and must be down to IE being pedantic about declaring the variable properly, the question is how should I be doing this?

View 5 Replies View Related

Pass The Variable Status Using A Form And It Works In IE But Not In Firefox/Chrome?

Oct 5, 2010

If I do not have enough information provided, please tell me. I am VERY weak when it comes to Javascript.I am trying to pass the variable status using a form and it works in IE, but not in Firefox/Chrome.How it is called;

Code:

<select name='status' id='status' onChange=""doSubStatus()"">

Code:

function doSubStatus() {
var selStatus;
var statusList;

[code]....

In IE, the variables status and sstatus are passed. In Firefox, only status is passed.

View 3 Replies View Related

Eval() Delivers Incorrect Results?

Sep 27, 2006

I noticed weird results when using eval() to do some simple calculations. Here are a few eval() statements and the corresponding results from javascript:

eval("1.2+0.97") =2.17
eval("1.2+0.98") =2.1799999999999997
eval("1.2+0.99") =2.19
eval("1.2+0.981") =2.181

This can happen with other numbers as well, but certainly not with any combination. I have confirmed this on Firefox and Safari, two different versions of OS X and both Intel and PowerPC Macs.

View 4 Replies View Related

JQuery :: Detect If Datatype Is Incorrect?

Apr 21, 2010

I'm just getting into jquery and was testing to see how I could handle php/mysql errors on my ajax function page. I thought that if I set the datatype to xml and since the error page was html it would throw an error but it doesn't. How can I handle this?

View 5 Replies View Related

JQuery :: Getting Incorrect Returned Results?

Aug 24, 2009

I am pulling in an XML doc, storing it in a global var and through out the app I am transversing it to grab certain info. Up till 1.2.6 it's been working fine, but when I upgraded 1.3.2 I get bad results.

Here are my two test pages:

[URL]

My guess is the it has something to do with Sizzle but I can't place exactly where the issue may be happening.

View 1 Replies View Related

Incorrect Values Of Element Positions

Oct 30, 2009

I'm developing a chess game recorder (records chess games just like electronic score sheet) and i am trying to write a function that handles the "en passent" rule in chess. However, when i try to test to see if a Black pawn is at a particular x,y location, it is always giving me back "50px". Even when it's not at that location. i uploaded semi-live version to my website here: [URL] you just click on the 'Play' button to start the game here's the function in question:

[Code]..

View 4 Replies View Related

JQuery :: Table Cell Width Is Incorrect?

Oct 19, 2010

However, I finally ran into a problem that I can't figure out. When I try and get the width of any cell in a table it's returning a width of 83 or 84. I have the table inside a div that has a width of 757px. I don't have a width set on the table itself, but each cell is set to 100px. I've tried to set the width in a css file and inline neither of which give me the 100px that I'm thinking it should return. I've tried both width(), outerWidth() and innerWidth(). The only one that returns a different number is outerWidth.

View 6 Replies View Related

Show Error If Incorrect Value Is Entered In Textbox?

Oct 4, 2010

Does anyone know of a place to get a code that looks at what is typed in a textbox and displays a green checkmark or a red x next to the textbox if the value entered is invalid. Eg. if no @ is entered in the email field, a red x would be shown next to the email field. Eg. if a zip code contains letters, a red x would be shown next to the zip code field. Eg. if the email field contains a @ and a period, a green check would be shown next to the email field. Etc. The green check or red x would have to be shown either as the user is typing or after they go to the next field (Blur).

View 1 Replies View Related

JQuery :: Id Names Of Valores Are Incorrect In The Last Loop

Oct 11, 2011

i am using this script

Code:
<script type="text/javascript">
$(document).ready(function() {
for ($i=0; $i<4; $i++) {
var num = $('.clonedInput').length;
var newNum = new Number(num + 1);
[Code]...

all works well, less one thing. The id names of valores are incorrect in the last loop.

[Code]....

View 2 Replies View Related

Incorrect Input Of Email Address On Forms?

Apr 10, 2009

I should imagine others here have experienced it. The user completes your form, and they unintentionally input their email address incorrectly. Then when you reply to their form, you then get the mailer daemon returning your email! Now, there's a couple of ways that some websites try to solve this problem - some ask the user to input their email address twice, some show the forms results on the next page, so that the user has a last chance to check, before completing the submission. Are there any other ways of trying to ensure that, as much as possible, that the user inputs the correct email address?

View 10 Replies View Related

Variable "newBook" To Save The Whole Object - Returns To Save Only The Last One

Dec 6, 2010

Code: //Define the class
class author{
function author(a:String,b:String,c:int)
{
this.name = a;
this.lastname = b;
this.age = c;
}
[Code]...

in this code the variable "newBook" to save the whole object, returns to save only the last one that was created...

View 1 Replies View Related

JQuery :: Drag And Drop Selecting Incorrect Elements

Aug 5, 2011

Im working on some drag and drop logic similar to the jQuery shopping cart example, but I've run into a small hitch. If I double click on the LI within my 'dropped' area it causes them to become draggable again. I specifically set up drag to only work from one source list, so Im unsure how double clicking is causing this bug?

View 1 Replies View Related







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