javascript

Password protected hyper link with target=_blank

I have a hyper link like this : <A Href=My_Java_Servlet?User_Action=Admin_Download_Records&User_Id=Admin onClick=\"Check_Password();\" target=_blank>Download Records</A> When a user clicks on it, a password window will open, the user can try 3 times for the right password. The Javascript looks like this : <Script Language="JavaScrip...

delay JQuery effects

I want to fade out an element and all its child elements after a delay of a few seconds. but I haven't found a way to specify that an effect should start after a specified time delay. ...

Is there a good embeddable code widget for blogs

My co-founder is currently asking on our blog for an embeddable code widget. http://devver.net/blog/2008/10/someone-please-build-an-awesome-embeddable-code-widget/ Basically we want something like http://pastie.org/ or http://codepad.org/ but we really want to embed the code section in our blog. We know there are plugins for common blo...

Passing state to a callback in JavaScript an appropriate use of closures?

Suppose you want to make an async request in JavaScript, but you want to pass some state along to the callback method. Is the following an appropriate use of closures in JavaScript? function getSomethingAsync(someState, callback) { var req = abc.createRequestObject(someParams); req.invoke(makeCallback(someState, callback)); } f...

Create an empty object in JavaScript with {} or new Object()?

There are two different ways to create an empty object in JavaScript: var objectA = {} var objectB = new Object() Is there any difference in how the script engine handles them? Is there any reason to use one over the other? Similarly it is also possible to create an empty array using different syntax: var arrayA = [] var arrayB = ne...

Invoking javascript in iframe from parent page

Basically, I have an iframe embedded in a page and the iframe has some javascript routines I need to invoke from the parent page. Now the opposite is quite simple as you only need to call parent.functionName() but unfortunately I need exactly the opposite of that. Please note that my problem is not changing the source url of the iframe...

Minimum time between subsequent AJAX calls

In AJAX applications that need to poll the server in regular intervals (like a chat applications), what is the recommended minimum time between two calls, so that the update is done as quickly as possible? What times are considered as hogs for the server and the client? ...

How to reference an input within a form in jQuery

An easy jQuery question. I have several identical forms ( except their name ) on one page with a few hidden inputs in each. I want to refer to them by using the form name and then the input name. ( the input names are not unique in my page ) So for instance: var xAmt = $('#xForm'+num).('#xAmt'); I really want to supply these value...

ASP.NET AjaxControlToolKit Accordion set active pane via javascript

I would like to be able to change the active pane of an accordion using javascript. I see a behavior set_SelectedIndex but I can not seem to get it to work. How can I find out what the supported methods are for this control? How can I set the selected index from the page? ...

Is there a map() function in ExtJS?

ExtJS has Ext.each() function, but is there a map() also hidden somewhere? I have tried hard, but haven't found anything that could fill this role. It seems to be something simple and trivial, that a JS library so large as Ext clearly must have. Or when Ext really doesn't include it, what would be the best way to add it to Ext. Sure, I...

How can I access BadgerFish notated attributes using javascript?

I have created a json object from ruby with cobravsmongoose, however the attributes have the '@' symbol in front of them. Whenever I try to access them with standard object notation in JavaScript, such as object.object.object.@attribute I get a parse error. Is there another way to access these objects? ...

Best way to read/set IE options?

What is the best way to read and/or set Internet Explorer options from a web page in Javascript? I know that these are in registry settings. For example, I'm using the JavaScript Diagram Builder to dynamically generate bar charts within a web page. This uses the background color in floating DIVs to generate the bars. I would like to ...

SAAS per seat authentication

Hi Our company makes the web based application which is priced per workstation. That means that user/pass credentials should only be used from one particular machine. Currently what is happening that several users are sharing credentials and we do not have any way to prevent this if they are not doing it concurrently. The nature o...

jQuery and "Organized Code"

I've been struggling lately with understanding the best way to organize jQuery code. I asked another question earlier and I don't think I was specific enough (found in this question here). My problem is that the richer you make an application, the quicker your client side gets out of control. Consider this situation... //Let's start so...

Java -> Apache Commons StringEscapeUtils -> escapeJavaScript

For a very simple ajax name lookup, I'm sending an id from the client webpage to the server (Tomcat 5.5, Java 5), looking it up in a database and returning a string, which is assigned to a javascript variable back in the client (and then displayed). The javascript code that receives the value is pretty standard: //client code - javascr...

The fifteenth of February isn't found

I'm in javascript, running this in the console d = new Date(); d.setMonth(1); d.setFullYear(2009); d.setDate(15); d.toString(); outputs this: "Sun Mar 15 2009 18:05:46 GMT-0400 (EDT)" Why would this be happening? It seems like a browser bug. ...

Insert text in Javascript contenteditable div

Hi guys, I have a problem where I need to insert a text (string, may or may not have html tags) to a div. It has to be a div and not a textarea. Is there anyway to do that? First of all, I need to get the cursor position, then inserting the text in that position. It's similar to function insertAdjacentText, but it can only insert befo...

Access an asp:hiddenfield control in JavaScript

What is the best way to access an ASP.NET HiddenField control that is embedded in an ASP.NET PlaceHolder control through JavaScript? The Visible attribute is set to false in the initial page load and can changed via an AJAX callback. Here is my current source code: <script language="javascript" type="text/javascript"> function Acc...

How can I delete my browser cookies using javascript?

How can I delete the session information from my browser by using javascript? Is it possible to do? ...

I need to get all the cookies from the browser

I need to get all the cookies stored in my browser using javascript. How can it be done? ...