javascript

IE and Chrome not executing unexpected javascript that comes up during runtime

I am using GWT and google maps. I created a custom infowindow which contains a script that will send an http request to twitter for the most recent tweets. i want to display this content inside a tab of the infowindow, but it is only working as expected in firefox. I suspect that this may be the case because IE and Chrome need to know...

ASP.NET control with visible=false cannot be used in javascript?

I have an ASP.NET text control "FromDate" whose visible property is set to false, but I wanted a client side javascript to be able to toggle the visibility property using CSS properties element1.style.display = "none"; // hides the element element1.style.display = ""; // shows the element but when I attempt to get the textbox, I get ...

Determining how big an element will be in Javascript

I need to position an element in the exact centre of the page (using fixed positioning) and need to calculate the expected size. For example I would add HTML like this: <div class="window" style="left: X; top: Y"> <h3 class="title">Title</h3> <img src="file.jpg" width="300" height="200" /> <div class="controls">Some stuff</d...

One-by-one jQuery scrolling loader acting up in WebKit

I've been working on a little experiment where, as you scroll, new entries are loaded onto a page. You can see a practical example here. Now, if you look at this Firefox everything works as it should. As you scroll towards the bottom of the page entries start to load but only one-by-one. View it in WebKit and instead it will start to l...

Disable redirect in fb:request-form Send/Cancel button

Hi, How do I disable the redirect in Facebook's invite form? <fb:serverfbml style="width: 600px; height: 650px;"> <script type="text/fbml"> <fb:request-form action="index.php" method="POST" invite="true" type="MyApp" content="Please hav...

Why do JavaScript objects not have a toJSON() method?

As described at http://www.json.org/js.html, JavaScript objects can dictate how they are serialized by JSON.stringify() by implementing a toJSON() method. For an arbitrary object, this method is not defined, while numbers and strings seem to implement the method. I'm curious--why do objects not have an implementation? EDIT: I originally...

Add value to an array

In PHP, I'd do something like: $array = array(); $array[] = "value1"; $array[] = "value2"; $array[] = "value3"; How would I do the same thing in jQuery? ...

Simple JavaScript Question, returning NULL in IE but working in FireFox!

Hi. I have this function correctly linked in an external .js file... function SubmitAge(age, UpdatePanelID, HiddenAgeID) { $get(HiddenAgeID).value = age; __doPostBack(UpdatePanelID); } and am calling it like this from an onClick of an a href="#" ... html tag (tags removed, please scroll right as stackoverflow has the greatest ...

Refactoring Javascript

I have a lot of code in the admin area of my site that is, basically just CRUD operations using AJAX posting. I was wondering if you had any tips on refactoring these type of functions either into generic functions or classes etc. Here is some sample code, though a lot of this is duplicated in other functions with just different ajax p...

JavaScript Undefined Error

Hi, I'm getting this JavaScript error with IE explorer: 'Slideshow is undefined' The error points to this bit of code: <script type="text/javascript"> new SlideShow('listOfImages'); </script> Does anyone know how I can fix this? Thanks! ...

Prevent parent container click event from firing when hyperlink clicked

On my web page I have a list of files. Each file is in it's own container div (div class="file"). Inside the container is a link to the file and a description. I wanted to allow a user to click anywhere on the container to download the file. I did this by adding a click event to the container and retrieving the href of the child link. ...

How to Slow down the browser

I am trying to test my application performance in different browsers (specially ie6). Also I have ie8, ff and Chrome installed. I am using tool like ietester to see how my app looks in ie6. I am trying to find a way, as how my application will behave if the browser is relatively slow (keeping the bandwidth/network speed same.). Is ther...

Consecutive Ajax requests without jQuery/ JS library

I have an issue, mainly with IE. I need to be able to handle n queries one after another. But If I simply call my function below in a for loop IE does some strange things (like loading only so many of the calls). If I use an alert box it proves that the function gets all of the calls, and surprisingly IT WORKS! My guess is that IE need...

PHP variable inside a javascript function

Hello every1! I'm attempting to put a php variable inside a javascript function and having no luck, here's what I got <a class="code" href="javascript:void(0);" onclick="javascript:if(window.dd && dd.elements) d.elements.name1.moveTo(<? echo "$xpos"; ?>, <? echo "$ypos"; ?>); return false;"> name1.moveTo(name1.x-20, name1.y+...

How can I load data on a page based on this being added into the URL #a=1380369&i=23007472

On a php page with javascript (jquery) in the urel I would like to have something like this idex.php?var=something*#a=1380369&i=23007472* The page will load photos and have a next and previous link, when this is clicked on it will use ajax to load the new image into the page but I need to also change the URL to add someting like this ...

Javascript header equivalent in JsTestDriver/Javascript testing

Hi all: I want to insert a function before the DOM or jQuery's document.ready loads in my JsTestDriver test file. I tried inserting it in the setUp function, but upon alerting the length of document.ready list in the first line of code, the document.ready has already been loaded. I have tried inserting tags to it, but JsTestDriver doe...

modal using prototype in rails

How to open an iframe modalbox in a rails app using the prototype javascript library? ...

How to implement a bounty slide like SO?

It looks very nice, is it hard to implement? ...

Javascript match doesn't work in IE

I have the following code. function rgb2hex(rgb) { rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); return "#" + hex(rgb[1]) + hex(rgb[2]) + hex(rgb[3]); } Seems to work ok in FF and Chrome. IE comes up with '1' is null or not an object. rgb value does seem to make it to the rgb.match. Any ideas? Thx ...

disable scrolling on input focus in javascript

I was wondering if it was possible to stop the page from scrolling using javascript when a user type or clicks on a <input type="text"></input> ...