javascript

Find and move an object in javascript array by id of an objects

I have 2 arrays of objects. Each object has an Id property. Now, if I have a 3rd array of just Ids, what is the better and faster way of finding objects from array1 based on those Ids and moving them to array2. Thanks a lot for answering.. Sample code: Person = function(id, fn, ln) { this.id = id, this.firstName = fn, this.lastN...

JavaScript not being loaded. Tried everything I can think of...

Hi. Swimwire.com is no longer loading JavaScript properly since I installed an update to its Social module, JomSocial. It's something to do with JomSocial, I'm certain, since on the homepage no JavaScript properly works (there's a blue bar along the top that should be clickable and contain the words 'Open Control Panel', but it doesn't ...

Toggle a large set of page items with jQuery is slow

I have a large set (around 100) of page elements that I would like to toggle (show/hide) with jQuery. I just use $(".toggleElementClass").toggle(); This looks like the trivial solution. The problem is this takes a few seconds, even on the latest Chrome browser. Is there a faster, more efficient way to achieve the same effect. ...

Why is Magento 1.4 including javascript files by filesystem path?

I am in the process of testing a Magento 1.3 site using Magento 1.4. I am seeing very weird and inconsistent behavior. Instead of including the URL of my javascript files, Magento is creating tags with the full filesystem path of the js files, as so: <script type="text/javascript" src="/home/my_username/public_html/js/prototype/prototyp...

javascript turned off help

I am creating a small application where I am displaying some text wrapped in 3 divs so I am actually displaying 1 div at a time also there are prev and next buttons for users to toggle between the div's. Now when javascript is turned off i just want to display 1 div without the prev and next buttons. I have and idea that it can be done w...

internet explorer 7 iframe unloads when going back

Hi this is my first post here, so please be kind ;-) i'm implementing a browser history manager, just like rsh or yui browser history manager. The idea was not to constantly poll the url hash of a hidden iframe, but to capture the onscroll event of an iframe, when it scrolls to an anchor name on an urlhashchange. So on every click i a...

Javascript Regex literal with /g used multiple times

Hello, I have a weird issue working with the Javascript Regexp.exec function. When calling multiple time the function on new (I guess ...) regexp objects, it works one time every two. I don't get why at all! Here is a little loop example but it does the same thing when used one time in a function and called multiple times. for (var i ...

Element reference is always null on IE8

I´m trying to reference a submit button: <input name="submit" type="submit" id="submit" tabindex="5" value="Submit" /> Tried this: var submit_btn = $('submit'); and also with document.getElementByID('submit'). But it always evaluates to null.. Also tried to loop all form elements to reach the button as lastChild but the result is all...

Javascript Cookie and Redirect Question

Hello, I have two scripts that do what I want, but I need to combine them. Basically if there is a cookie for "US" then it let's the user browse the US site. However if no cookie exists then I want it to run the Geo redirect based on location. They both work on there own but I can not for the life of me get it to do the cookie part firs...

How to customize only arrow of <select> dropdown?

This is code of dropdown <select id="dropdown"> <option value="">Go to page...</option> <option value="http://stackoverflow.com"&gt;CSS-Tricks&lt;/option&gt; <option value="http://superuser.com"&gt;Digging Into WordPress</option> <option value="http://metastackoverflow.com...

Server side browser that can execute JavaScript

Is there any programming libraries available that will parse an HTML document, execute JavaScript and then allow me to navigate the DOM?  This needs to be performed server side, not client side. Any language will do, but Java, PHP, or Ruby are preferred. ...

Copy Paste In JavaScript

Hi everybody ::- ). This is an age-old question, but I'm still having trouble with it. You see, I'm trying to paste some Excel data in a Text Area, but the silly browsers freeze for long periods of time when doing this, because of God-knows-what "smart" parsing they do. I can't get rid of that (file upload is out of the question, my boss...

Same code on browser/server

I'm writing a web app using PHP, and running into several situations where I need similar code on the server and browser. For example: I want to validate user input, and generate the same error messages on both sides. I want to format data using certain rules (e.g. if a given field is less than 1, show it with two decimal places, other...

Spent too long coding and now I can't get the most simple script to work

Someone please point out why this script is not working. It started out as an AJAX script and I took line by line away until I was left with a function containing an alert and it still will not work in IE. So please someone put me out of my misery. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <meta http-e...

Media Player Popup

Using Javascript how I can bring up a MediaPlayer Popup on the side of the screen and leave it there as the user navigates through various pages in the site. Similar to http://www.billboard.com and how they have the LALA player. ...

How to clear the canvas for redrawing

Hi there, After experimenting with composite operations and drawing images on the canvas I'm nog trying to remove images and compositing. How do I do this? I need to clear the canvas for redrawing other images; this can go on for a while so I don't think drawing a new rectangle every time won't be the most efficient option. Thanks! ...

How to scrape images from a web site with javascript and servlets

I have a web page that has the following content (I've changed the URL in the src tag for privacy purposes, otherwise viewing the page source is identical): <HTML> <BODY> <script type="text/javascript" src="http://localhost/servlet?publicKey=abcdefg12345678&amp;amp"&gt;&lt;/script&gt; </BODY> </HTML> The resulting page displays an i...

Script only works while alert box is in the script

If I take the alert call out of the following script firebug says that results is undefined?` <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt; <html> <head> <title>Inventory Management</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> ...

Why does my jQuery "complete" callback break in Chrome & Safari but work fine in FF?

I have some problem with this jQuery code. I'm new at this but it works in FF and yet breaks in Chrome and Safari. Grateful for suggestions in any way. $('#level1nav ul li a:last').click(function () { $(lastBlock).animate({height:"400px"}, {queue:false, duration:500, complete: function() $(line).animate({width:"0px"}, ...

jquery.simplemodal-1.3.3.js : absolute positioning (vs. fixed)

I'm using Eric Martin's sweet 'simplemodal' jQuery plugin. It works wonderfully and would recommend it to anyone looking for a lightweight jQuery-based modal dialogue solution. That said, I have some particularly long content that "needs" to be displayed as a modal. By default, the container element uses 'overflow:auto' to handle conten...