javascript

DataTable and javascript

Is there a way to avoid postbacks with gridview every time a row is added to it? In other words, can I store the DataTable on the client and pass it on to the server control when I am done to save, rather than do postbacks every time the row is added? I searched and searched....all I could find was web services, JSON, and I have a fee...

What's a simple way to convert between an am/pm time to 24 hour time in javascript.

I've been playing with jquery and I've run myself into a time problem. I've got 3 time input select boxes, one for hours, one for minutes, and one for the Meridian. I need to convert this time into a 24 hour string format and then stick it into a hidden input. var time = ""; time += $("#EventCloseTimeHour option:selected").text(); time ...

How can I avoid EXTjs with YUI-based alternatives to EditorGridPanel and ColumnTree?

There's some discussion at my work about using Jack Slocum's EXTjs library as an extension to YUI (already in use) for a project in development. I'd like to help avoid a dependence on EXTjs's commercial licensing model if possible. The primary two features desired from EXTjs are EditorGridPanel and ColumnTree. As far as I can see, it ...

What jQuery annoyances should I be aware of as a Prototype user?

We're considering switching our site from Prototype to jQuery. Being all-too-familiar with Prototype, I'm well aware of the things about Prototype that I find limiting or annoying. My question for jQuery users is: After working with jQuery for a while, what do you find frustrating? Are there things about jQuery that make you think abou...

jQuery: delay interval of ajax function till previous run is completed

I've set up an AJAX page refresh with setInterval. From time to time, the server is so slow that a new request is initiated before the previous one has completed. How can I prevent that? ...

Circle image overlays

I have a image in the shape of a Circle. The circle is broken into 3 equal parts. I have an image with the entire circle. I have 3 other images, each only a piece of the circle but in the color green. I have to do the following: Display the original circle image. Have a 3 buttons on the screen, each button is linked to the 3 parts ...

document.ready inside body tag

I have a web app that has a universal HTML header include, so I'd like to put page-specific scripts in each page instead of having it load for everything. I tried putting document.ready() near the end of the <body> of a page and it seems to be working fine. Are there any potential hazards to putting it there instead of inside the <head>?...

How does variable assignment work in JavaScript?

So I was playing around the other day just to see exactly how mass assignment works in JavaScript. First I tried this example in the console: a = b = {}; a.foo = 'bar'; alert(b.foo); The result was "bar" being displayed in an alert. That is fair enough, a and b are really just aliases to the same object. Then I thought, how could I m...

How to parse NULL value returned using YUI datasource

I am using YUI datatable and datasource to render data in one of my projects. The data returned happens to be NULL and YUI datasource is unable to parse it. Below is the declaration code of datasource and datatable. For readability sake, I am seperating each of the declarations. Column Descriptions declaration var columnDe...

How to make YUI datasource parse Null values in the dataset?

I am using YUI datatable and datasource to render data in one of my projects. The data returned happens to be NULL and YUI datasource is unable to parse it. Below is the declaration code of datasource and datatable. For readability sake, I am seperating each of the declarations. Column Descriptions declaration var columnDe...

How to detect mouse moving while left button down

I want to use javascript to detect the mouse position once the mousedown event has fired. It appears I am not getting an onmousemove event when the left button is held down. The cursor is changing to some circle with a cross through it. My whole goal is to detect the start position of the cursor on mousedown and change the top left st...

attaching same event handling code to multiple events in jquery

hi, i have an input element, and i want bind both change and keypress event with the input, but event handling code is same for both the events. is there any short way of doing this instead of writing the same code twice. well, i could write a method, but wanted to see if there is any easier way of doing this $("#inpt").change(function(...

How can I use jQuery to move a div across the screen

I need to make multiple divs move from right to left across the screen and stop when it gets to the edge. I have been playing with jQuery lately, and it seem like what I want can be done using that. Does anyone have or know where I can find an example of this? ...

When does reflow happen in a DOM environment?

What kinds of activities will trigger reflow of web page with DOM? It seems there are different points of view. According to http://www.nczonline.net/blog/2009/02/03/speed-up-your-javascript-part-4/, it happens When you add or remove a DOM node. When you apply a style dynamically (such as element.style.width="10px"). When you retriev...

Get & set caret position in contentEditable iframe (Firefox)

Hello! I've successfully done this for IE7. FF, no dice. any ideas? Thanks! ...

Firefox sidebar extension link loaded into a new browser tab. How-To?

I have a friefox sidebar extension. If its opened by clicking on the toolbar icon I load it with a webpage ( that I have authored ). Now, if the user clicks on the link on the webpage ( thats loaded into the sidebar ) I want the linked webpage to open up in a new tab of the main window. I tried with this in my webpage markup: <a target=...

Array.length problem in JavaScript

I've written this sample code to print the length of x. But for some reason, I am not getting anything! Help! <html> <head> <script type = "text/javascript"> function myF() { var x = [1,2,3,4]; var y = document.getElementById("thing"); y.innerHtml = x.length; } </script> </head> <body onload = "myF();" > <div id = "thing" > ...

Calling Javascript function returned from AJAX Response

I have a system where I send an Ajax command, which returns a script block with a function in it. After this data is correctly insert in the DIV, I want to be able to call this function to preform the required actions. Is this possible? ...

How to reference 'this' from a javascript call in a JSF component?

<h:commandLink id="#{id}" value="#{value}" action="#{actionBean.getAction}" onclick="alert(this);"/> In the previous simplified example, the 'this' keyword used in the Javascript function won't reference the generated A HREF element, but will reference to the global window, because JSF generates the following (simplified) code: <a...

AJAX validations in struts 2

Can we do client side validation using AJAX in struts 2 application ? If yes, then please let me know the procedure. ...