javascript

What is the scope of window.name in IE?

We have a product that has both a winforms and a web client, and are providing the users a way to launch into another company asset (a web application). We need to make sure that the user only ever has one instance of the other web application open in a browser (or at least that we've opened for them). We accomplished this (sort of) by d...

Internet Explorer's Operation Aborted and Latency Issue

If you don't know what the operation aborted error is, here's a Microsoft KB Article about it, http://support.microsoft.com/default.aspx/kb/927917 . There's also tonnes of posts about it but the simple answer for it's occurrence is this; the error only occurs if you try to manipulate a DOM element via JavaScript before the element you ar...

Determine if collection of elements are visible using JQuery like $(".someClass")

Hi, I have a collection of elements on my page, and I want to see if they are visible or not currently. So: $(".someClass") How can I loop through and figure this out? because if it is visible, i have to fire another function. ...

How to preserve aspect ratio when scaling image using one (CSS) dimension in IE6?

Here's the problem. I have an image: <img alt="alttext" src="filename.jpg"/> Note no height or width specified. On certain pages I want to only show a thumbnail. I can't alter the html, so I use the following CSS: .blog_list div.postbody img { width:75px; } Which (in most browsers) makes a page of uniformly wide thumbnails, all wi...

Javascript for adding a custom attribute to some elements

Given a section of HTML, can I selectively pick some types of elements (ex: input type) and add a custom attribute using Javascript. I would also need to remove this attribute if it exists. I have done this earlier using JQuery but am unable to use JQuery for this particular task. ...

Trouble with jQuery MaskMoney plugin and Field type Decimal (SQL SERVER table)

Hi people. I am using a ASP.NET MVC framework, jQuery library (1.3.2), linq to sql, sql server 2005. I have a problem with jQuery MaskMoney plugin, to save data in sql server table. I created a table, where this table have a field "valueProducts" type Decimal(18,2). In my page, I have a html field with jQuery maskmoney. Example: 10.00...

How can I make this javascript easier to read, maintain, and understand from an OO background?

I come from the land of Java, C#, etc. I am working on a javascript report engine for a web application I have. I am using jQuery, AJAX, etc. I am having difficulty making things work the way I feel they should - for instance, I have gone to what seems like too much trouble to make sure that when I make an AJAX call, my callback has a...

window.onload delay

i am trying to appendChild() on an existing form, and its not working. i wonder if i need to delay the page, at least i thought i read that somewhere. what i am thinking is dynamically altering window onload to be a delay. do i grab the body tag like any other DOM element? ...

Finding when an Iframe's content changes when in designMode

I have an Iframe which I have enabled designMode on. Quite simply I would like to have a callback function called if the cursor in the Iframe moves or content changes. It seemed quite simple at first but I can't use onchange/ onkeyup on the Iframe. I assume I need to add an event to a member of the Iframe. I've tried frames['writer'].d...

javascript form validation on server/local

I'm using javascript form validation for the entry form for a contest I'm running. It's inline CSS so that if certain conditions aren't met, it displays, in red, messages that say "please enter your email address" or "that doesn't look like a valid email address" etc. The script, which sits at the top of the file, looks like this: <...

Creating a Custom DTD for Visual Studio

I've got some custom templated controls which take JavaScript as template content, like so: <ns:Custom runat="server"> <contentTemplate> var a = new Array(); for (var i=0; i<a.length; i++) { // do something } </contentTemplate> </ns:Custom> I want VisualStudio to treat the content of exactly the same as it does ...

How to implement JavaScript Cascades..?

I'm reading "JavaScript the Good Parts" and it mentions cascades as a way to do method chaining in JavaScript but I can't find any code that explains how these methods should be implemented. getElement('myBoxDiv'). move(350, 150). width(100). height(100). color('red'). border('10px outset'). padding('4px'). appendText("Please stand by")...

Load list of image from folder

I have a folder of images, from 10 to 200, a webpage, a jquery fade and a php script that read folder full of images Is there any way to make the php script scan a folder, get a list of image (in an array ?) and pass it to jquery script ? (first question) Now, i can make a xml file from the result php list of files found or make a html...

Add page-specific javascript or CSS in Joomla

How do you include a javascript or CSS file only on a certain article in Joomla? I have one article which requires the jQuery UI and associated theme. Since this isn't being used on any other pages, I only want it for this particular article. Adding in the necessary <script> and <link rel="stylesheet"> tags in the HTML of the article do...

How can I append a new element in place in JavaScript?

I've created a JavaScript script that can be pasted on someone's page to create an iFrame. I would like for the person to be able to paste the script where they would like the iFrame to appear. However, I can't figure out how to append the DOM created iFrame to the location where the script has been pasted. It always appends it to the v...

Sleep in Javascript

Any way I can do a sleep in javascript before it's carry another action? Example: var a = 1+3; // sleep 3 seconds before the next action here var b = a + 4; ...

How would I implement stackoverflow's hovering dialogs?

I am in love with stackoverflow's single-color "click-to-close' hovering dialog boxes that greet a user when they try to vote and aren't logged in or use the site incorrectly. Any idea how and/or what technology Jeff used to implement these neat little devices? EDIT: I'm specifically talking about the SQUARE dialog boxes that say "Cli...

Can you get a subset of elements in jQuery as per a grouping amount?

Say I have 5 strong elements, and I want to wrap them in div elements, in groups of 2 using jQuery. Example: <!--original markup--> <strong>I AM STRONG</strong> <strong>I AM STRONG</strong> <strong>I AM STRONG</strong> <strong>I AM STRONG</strong> <strong>I AM STRONG</strong> Becomes <!-- new markup --> <div> <strong>I AM STRON...

Converting dates in JavaScript

How can I convert one date format to another format in JavaScript? Example: the old format is YYYY/MM/DD but I want to convert it into DD-MM-YYYY ...

How can I deduce a day for a date object in javascript?

How can I deduce a day for a date object in javascript? Example: If I assig a date into an object as below: var date_value = this.cfg.getProperty(cfgPageDate); and the date format in date_value as below: Fri May 29 2009 00:00:00 GMT+1000 (AUS Eastern Standard Time) how can I deduce a day from this object so that the object date wi...