javascript

Is it possible to simulate constants in Javascript using closures?

Is it possible to simulate constants in Javascript using closures? If so, can you please furnish me with an example? ...

How to detect Render Mode of browser for current page?

I know that modern browsers generally have two render mode: standard mode and quirk mode. The browser detects the heading DocType. The question is how to detect render mode of current page at runtime. Is there any Firebug tool to do that? ...

Figure Out if the Window Is In Focus

I have an uploader that takes roughly 30 seconds to upload the images, render the thumbnails, and move to another server. Is there any way to check after (or at any time) to see if they have lost focus of the window and if they aren't in focus to send an alert. (I would know how to send the alert, just need to figure out how to check if...

How to get image size (height & width) using javascript?

Is there any javascript or jquery apis or methods to get the dimensions of an image on the page? ...

How do I register a javascript event handler to an element that hasn't been added to the page yet

I'm trying to build a greasemonkey script which will dynamically create tables of data based on user interaction with... other dynamically created tables of data. My problem is that I'm having to make two passes every time I create a table: one to create the table, and another to go grab all of the objects in the table I want to add even...

Access parent's DOM from script in an iframe in IE Mobile

I have a framed window (currently iframe but may possibly be frame) - I do not have control over this. I would like to detect if my content is inside an iframe (or frame). I wanted to compare the location of the current document with the one the top object holds but it appears it is the same object (top === window). After extensive...

Javascript - object initializer?

I've realized you can have a property in an object run automatically like this: var obj = { init:(function(){ alert('loaded');})(); } I'm trying to use this method as an initializer for the object. The problem I'm running into is passing a reference to 'obj' to the init property. I suspect it generates errors because the obj has...

Why do these javascript regex throw syntax errors?

I am trying to validate a text string as a date before processing it, however both of the regex i have tried are throwing syntax errors and I can't see why. From what I can tell there is nothing wrong with either. These are the strings: var datePattern1 = new RegExp( (0[1-9]|1[012])[-](0[1-9]|[12][0-9]|3[01])[-](19|20)\d\d ); and va...

clone node on drag

i want to be able to create a copy of the element that i want to drag. im using the standard ui draggable and droppable. i know about the helper clone option. but that does not create a copy. the dragged item gets reverted back to the original position. ...

Why SWFUpload ASP.Net samples not working?

http://swfupload.org/node/7/release Why these samples not working, anyone faced the same thing and have a fast solution to make it work? The solution is compiling and the default page is opening normal in FireFox but when i click on the button nothing happen And in IE the button not appearing at all ...

Using FireBug for a website with frames

I downloaded Firebug and attempted to use it to debug JS for a site that uses frames. My understanding is when I go to the Script tab in Firebug, I would see the JS functions on the aspx and the JS in any files that are included and I would be able to set breakpoints. However, all I see on this site is: </head> <frameset> <frame src...

Changing the format of a date in Yahoo UI

I'm using calendar from Yahoo UI as follows: calDate = (calDate.getMonth() + 1) + '/' + calDate.getDate() + '/' + calDate.getFullYear(); This displays a MMDDYYYY format. I want to change this format to YYYY-MM-DD so that I can insert it into a MySQL database. I changed the code to: calDate = calDate.getFullYear() + '-' ...

jQuery Live Search with Quicksilver Style in a Multi Select List Box

I am trying to get John Resig's jQuery Live Search with Quicksilver Style to work with a select multi form control. His code is based John Nunemaker's Work developing his quicksilver.js code. The problem I am having is that within a select box only Firefox supports .hide() on option values, I can't figure out a snappy approach for IE, ...

What lessons can be learned from the prototype model in javascript?

The question is from a language design perspective. I should explain a little about the situation. I am working on a javascript variant which does not support prototypes, however it is overdue a decent type system (most importantly support for instanceof). The ecmascript spec is not important, so i have the freedom to implement somethin...

JQuery Script Load Timing

If I have a button that sets off a jquery script is there a way to make sure the button is inactive until the script completes? ...

change div based on how far down the page you have scrolled

I am trying to change the text inside a div based on how far down a page you have scrolled. I've been tinkering with jQuery's scrollTop and document height but have so far failed to produce the desired results. How would I get the position of an element on the page and then get jQuery to do something once you have scrolled to that eleme...

Problem with (X) button in window.

Hi, How to disable (X) button in window. I tried with some properties like titlebar=no/0 in window.open but it is not working fine. Can anybody help me with this query. Thanks in advance ...

How to check whether (X) button in clicked in popup window

Hi, I am trying to set the value to the hidden field in parent window from child window and want to set the value to the parent window only when popup window is closed. This is working fine when i use button to close the window. The script for the button is: onclick="javascript:window.close();" But the same condition fails when ...

Control Lightbox (Modal) From Code-Behind Of Asp.Net

Before meeting with Ajax and Jquery, in my projects I had a function like below. Public Sub Raise_Alarm(ByVal p_Page As Page, ByVal p_Message As String, Optional ByVal p_IsError As Boolean = True) strScript = "<script language= ""javascript""> alert('" & p_Message.Replace("'", "") & "')</script>" Dim t As Type = p_Page.GetType() ...

Techniques to make autocomplete on website more responsive

In my website's advanced search screen there are about 15 fields that need an autocomplete field. Their content is all depending on each other's value (so if one is filled in, the other's content will change depending on the first's value). Most of the fields have a huge amount of possibilities (1000's of entries at least). Currently ma...