javascript

$(document).ready equivalent without jQuery

I have a script that uses $(document).ready, but doesn't use anything else from jQuery. I'd like to lighten it up by removing the jquery dependency. How can I implement that functionality without it? It does more than window.onload. ...

Best jQuery drop-down nav Suckerfish alternative that works with Flash?

I think that my Suckerfish drop-down navigation does not play well with flash. I've done everything I can think of, yet my drop-down navigation keeps displaying underneath my flash movie. If I replace the movie with an image, it displays just fine. Only when I use a flash movie does the navigation display underneath the flash movie. I ha...

What's the most efficient way of filtering an array based on the contents of another array?

Say I have two arrays, items and removeItems and I wanted any values found in removeItems to be removed from items. The brute force mechanism would probably be: var animals = ["cow","dog","frog","cat","whale","salmon","zebra","tuna"]; var nonMammals = ["salmon","frog","tuna","spider"]; var mammals = []; var isMammal; for(var i=0;i<ani...

Why does Flash's ExternalInterface *sometimes* not work?

I have a Flash movie which has a number of actionscript 2 functions which are exposed to Javascript via ExternalInterface. Normally this movie works fine and Javascript can communicate with it. But sometimes, intermittently and without explanation, the flash object in Javascript will not have the ExternalInterface functions. This happens...

jQuery String Contains Manipulation?

In most languages like C# for example given a string you can test (boolean) if that string contains another string, basically a subset of that string. string x = test2; if(x.contains("test")) // do something How can I do this in a simple way with Javascript/Jquery? ...

jQuery and MSXML

MSXML6 is supposed to have the best security, performance, reliability, and W3C conformance (Using the right version of MSXML in Internet Explorer). Questions: Why does not jQuery use MSXML6? Does jQuery use MSXML3? (I think the answer is yes, see my update below...) Can i fetch the version of MSXML from an IXMLDOMDocument instance? ...

passing password values using javacript/ajax to php page.

iam using a simple insert script function to pass the values from registration html page to register php page. Here is my script: function insert() { // Optional: Show a waiting message in the layer with ID login_response document.getElementById('insert_response').innerHTML = "Just a second..." // Required: verify that all fileds is not...

Loop through JSON object List

Hello, I am returning a List<> from a webservice as a List of JSON objects. I am trying to use a for loop to iterate through the list and grab the values out of the properties. This is a sample of the returning JSON: {"d":[{"__type":"FluentWeb.DTO.EmployeeOrder", "EmployeeName":"Janet Leverling", "EmployeeTitle":"Sales Representative...

clientWidth Performance in IE8

I have some legacy javascript that freezes the tfoot/thead of a table and lets the body scroll, it works fine except in IE8 its very slow. I traced the problem to reading the clientWidth property of a cell in the tfoot/thead... in ie6/7 and FireFox 1.5-3 it takes around 3ms to read the clientWidth property... in IE8 it takes over 200ms...

Rearranging table in JavaScript

I want reorder table rows using JavaScript . for eg: <table> <tr> <td>1</td> <td>2</td> <td>3</td> <td>4</td> <tr> <tr> <td>A</td> <td>B</td> <td>C</td> <td>D</td> <tr> <tr> <td>A1</td> <td>B1</td> <td>C1</td> <td>D1</td> <tr> </table> I want to do this in JavaScript without...

Using a reference parameter on ActiveX via Javascript

I have an ActiveX (3rd party, no source) with a method that has a reference parameter like this: HRESULT GetSomething( [in] short param1, [out] BSTR* someString); In C++ you'd execute it like this: BSTR someString = NULL m_activeX.GetSomething(0, &someString); How would I execute this via Javascript? All other functions in the Act...

Object Oriented Javascript

Hi, In the course of programming we encounter large javascript files which are open source and written in an object oriented manner( like JQuery ). If we need to modify these files we have to have a basic knowledge of the members and the flow. If we have multiple files then the task is much more difficult. Where do I start to get the f...

AJAX (prototype/php) getting partial status updates during script execution

I have a process I want to run in the background of a page. The process will take a while to run, lets say a few minutes. I have it set up so that from the page I can click on a button to start the process off, wait a bit and then it will finish and I can have the page update notifying me that the process was run successfully. I'm doing...

Null object in javascript

Why null is considered an object in javascript? Is checking if ( object == null ) do something same as if ( !object ) do something And also What is the difference between null and undefined?? ...

How to implement collapsible table rows in Javascript?

I'd like to have tables that can dynamically collapse some rows in a web page, such as: | Title | Foo | Bar | --------------------------------- | + My First Section | --------------------------------- | + My Second Section | --------------------------------- can dynamically exp...

Redirect document.write from javascript script

We want to serve ads on our site but the adserver we are in talks with has issues with delivering their advertising fast enough for us. The issue as I see it is that we are supposed to include a <script src="http://advertiserurl/myadvertkey"&gt;&lt;/script&gt; where we want to display the ad and it will then download a script and use do...

Why is JSON important?

I've only recently heard about JSON (Javascript Object Notation). Can anybody explain why it is considered (by some websites/blogs/etc) to be important? We already have XML, why is JSON better (apart from being 'native to Javascript')? Edit: Hmm, the main answer theme seems to be 'it is smaller'. However, the fact that it allows data fe...

How to select a character range in a textarea using Javascript?

Simple question - is there any way to select a sub-set of the text displayed in a <textarea> control using Javascript? e.g. have a function like selectText(startCharNo, endCharNo, textareaName); It also needs to be IE6 compatible. ...

Can I store cookies for different domain in Javascript

Please, I would like to set cookies for my browser by my script running at my domain.. but I want to set cookies from another domain. For example, I would like to set cookies that twitter.com sends me (when I would visit by browser), but I don't want to visit their page for the first time. Only when I visit their page after running my s...

Including loads of css files and Javascript file - how do I optimize

Duplicate: Multiple javascript/css files: best practices? Hi guys, my application is almost done but the thing is that I've noticed that I'm including a lot of external javascript files and css. I'm using a lot of third party free plugins here and didnt want to touch the code for fear of messing something up. But the result is that I n...