javascript

Javascript References Array

I have a big multidimensional array that holds references to objects and I need to be able to move a reference from one spot in the array to another and then delete the original reference (or set it to undefined). The problem with this is it then deletes the recent reference. var data = [[new Obj, new Obj], [new Obj, new Obj]]; functio...

Why is this small javascript not working?

I have multiple instances of a div with an id of "myDiv" on a page. I want to replace the contents of these divs. When I use this javascript: function replaceContent(id, content) { var container = document.getElementById(id); container.innerHTML = content; } replaceContent('myDiv', 'hello there'); <div id="myDiv"></div> <div ...

How to rewrite the code using jQuery

How to rewrite the code using jQuery? <script type="text/javascript"> window.onload = function(){ var array = document.getElementsByTagName('div'); for (var i=0; i<array.length; i++) { (function(i) { array[i].onclick = function() { alert(i); } ...

How do i apply fadein and fadeout effect for this?

Hi there, i have a navigation menu and i am using the hover element to change the image when an hover event occur. i am using the following CSS #navigation li.contact a:hover { margin-left:1px; background: url('../img/hover.jpg') no-repeat; float:left; width:147px; height:109px; } my navigation menu is composed o...

google analytics how does it save data?

Hi , I understand that google analytics uses first party cookie tracking, so it sets the cookie from the domain being visited with javascript (rather than setting the cookie from google-analytics.com) I am wondering how the ga.js google analytics script saves the cookie data to the database to be reported on by google analytics? I can...

HOW TO check if an external CSS file is loaded using Javascript

Hi Guys, I have a function doing the following using javascript: Create link element and set href=cssFile. Insert the link element in head tag. Create a div element. Set the class name using setAttribute appendChild the div on body. Now getting CSS rule value using document.defaultView.getComputedStyle(divElement, null)[cssRule]. No...

Comparison of Regex flavours

I wonder if there is a comparison between the features of various regex metacharacters in various implementations. The sort of thing I am looking for is a table like Language Perl sed grouping ( ) \( \) Languages I am interested in are Perl, Sed Java Javascript ...

Problem with jQuery Coda Slider and IE7

Hi, I have this website using "jQuery Coda Slider" but the slider is not working in IE7. It works with no JavaScript errors both on IE8, Firefox and Google Chrome, but not on IE7. Can you please help me? The website's at http://portelaresidence.com/ . Thanks in advance for your help. ...

Prevent displaying unstyled page when doing a page-refresh.

How could I prevent my page displaying an unstyled view while the page is loading ? I think its probably because of the order of loading different JavaScript-files. Is there a best-practice, for example loading plugins before my own code ? Should every jQuery/.js-function called after document.ready or windows.load ? link to page Than...

How to make <option>s of <select> show or hide using javascript?

I want to make the options of < select > show or hide by program(JS),is it possible ? it just like the interesting tags in the front page of StackOver Flow,when you type in some words,the drop list will expand and give you suggestions. ps.I know StackOver didn't use select in this case,anyway,just take it as an example. ...

What's wrong with my code

This is the first thing I write in javascript, so I hope its a basic error What I'm trying to achieve here: Take a bunch of links from a page, load their contents query for links inside and add them to a list on current page. I get error on the append And in JQ documentation they say the method can get a JQ object <script type="text/j...

Google AJAX Search - Automatically Load Default Result

Hello, My search page is search.html and when people open that page by default i want to display result for "myword" how to do that please help me and here the code: search.html <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Google Powered Site Search Demo</title> <script sr...

How to "fullscreen" a jqGrid?

Hi all I'm using jqGrid with jQuery to display some data on an application I'm building and am struggling over extending its abilities. How would I go about toggling a "fullscreen" mode for the grid. i.e. expanding the grid to the full size of the page, on top of the other elements? Thanks all, Gausie ...

HTML onmousedown/onclick display hidden HTML

I'm making a form to order different varieties of sweets from a website. At the moment I have checkboxes with each variety. Once they have chosen the varieties they want (they can have more than one) then I need some more information. To do this I want to display a new box when they check each checkbox. Event attributes seem to be adequa...

jquery.corner problem with IE8

Been making this site for the past week. Only just came across this error in IE8. There's an error in the jquery.corner.js file: Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729) Timestamp: Sat, 25 Sep 2010 16:13:34 UTC Mess...

Wait for jPlayer to finish loading files before continuing loop

I'm using the jQuery audio player 'jPlayer', I have a loop which creates a number of jPlayer unique instances then assigns an on click 'jPlayer play' to another part of the document for each instance.. The problem is jPlayer uses an internal ready: function() {} to assign the audio path and load the file.. I need to wait for this functio...

calling jquery from a javascript function

Hi , <html> <head> <script type="text/javascript"> function display(id) { // open jquery modal window using jquery UI } </script> </head> <body> </body> </html> I want to open jquery modal window using jquery UI whenever the function display is called using normal javascript function call . I can use .diolog function of jquery...

javascript widget to display a book catalogue. (need re-ordering and persistent)

A book has several chapters, and each chapter has several sections. This could be deemed as either a two-level tree or a nested list. Now I need to display the catalogue of the book. And the user can drag-and-drop to re-order chapters and sections. Do you know any good javascript widget for this? After the re-ordering, the new orde...

Is there any easy way to get DOM descendants like with the parents() method when using jQuery?

$('something').parents('selectors') lets me move several levels up the DOM at once, versus parent() which unsurprisingly returns the current element's immediate parent. Unfortunately (though logically), children() does not operate like parents() and instead only returns the element's immediate children, similar to how parent() works. I'm...

Why should I test for both MSXML2.XmlHttp and Microsoft.XmlHttp version-independent ProgIDs?

I have read the MSDN blog post about the subject. And this question doesn't help me much either. As far as i can tell checking Microsoft.XmlHttp is enough. Someone could confirm me this bug? Are there any earlier version of IE which require detecting both? ...