javascript

Looking for a good, practical example how to use JQuery or YUI with Java web application

I am looking for an extensive example or, the most preferably, an open source project with a nice, modern, ajax-enabled user interface which is using JQuery or YUI on top of Java web application - it can be full Java EE application, JSF only, Spring MVC application, anything. I would like to learn what are best practices to create such ...

Is contentDocument.location.reload compatible with IE 6

I'm busy writing a application that refreshes a IFrame completely using javascript, now my issue is that I'm getting the following error in IE 6 'document.getElementById(...).contentDocument.location' is null or not an object My code looks like this document.getElementById('mobi').contentDocument.location.reload(true); and mobi exi...

HTML/Javascript inking or drawing control suggestions?

I am looking for something that will allow users to write out a signature in an HTML form. I am looking for something that will run locally on the machine so if it can be done through a javascript function or something else that would be great. I have seen the canvas HTML5 object, but I haven't found any examples that work well with IE...

Javascript - Pass a value from dropdown box to Google Maps API

I am creating a quote form for a taxi firm using Google Maps API. Currently, the user enters a start point and a pick up point into 2 text boxes and the API calculates the distance between the two points and the cost of the journey. I am trying to add two dropdown boxes with set locations so that the user can either select one of these ...

IFrame targeting another IFrame

I have a parent page containing two iframes. One holds navigation links and the other should display the information pertaining to the navigation link clicked in the first iframe. So I need to target the one iframe from within another iframe.Is this possible? If so how does one go about it? ...

How to hunt down HTTP request?

Trying to optimize one web project. It uses asp.net (webforms), bunch of jquery plugins and whatnot. Problem: there's unnecessary HTTP request to localhost/undefined and that makes every request take ~1s longer than needed. Question: is there any tactic to find guilty code? Clue: undefined makes me think that there's JS involved. Fi...

Quickly repaint array of unicode symbols in JavaScript

I want to change background/foreground color of many symbols with the same CSS class. Right now I'm doing it with jQuery like $('back_COLORED').css('background-color', '#00FF00'), but this approach is slow when there are many elements with such class (>900). Seems it's because jQuery don't change CSS rules itself, but finds all element...

Is there a way to catch all keyboard input in a browser?

Is there a way to catch all keyboard input in a browser? Im guessing it would have to be JavaScript. My problem is that I have a USB Bar Code Scanner which the computer treats as a second keyboard. I dont want the user to have to click on the input box for bar codes to be entered in it. But I also want them to be able to hit key short c...

How to change options in a select list, based on the selected option of a previous select list?

What would be the best approach to this? Thanks ...

Is there a way to fire jQuery's live() or delegate() without a user event?

I am trying use jQuery to poll dynamic DOM nodes, created outside of the jQuery object (with Google Maps API methods). I can do this easily by, for example, binding delegate() to a click event. However, I need to poll the DOM, without any additional user actions (user should not have to click), as part of a function that runs onload. Doe...

Best practice for using JavaScript on partials and views in ASP.MVC?

I started removing part of a view into a partial so that it could be reused on another view. However, I got stuck because there are some JavaScript functions on the original view that call some of the functions that belong to the partial. It seems wrong to call functions that are defined on the partial from the containing view (and vice-...

How is the force reload of javascript/css done in Symfony?

After reading this thread: http://stackoverflow.com/questions/118884/what-is-an-elegant-way-to-force-browsers-to-reload-cached-css-js-files I would like to know if there is any built-in function or easy way in Symfony that automatically forces a reload by appending a random querystring or timestamp to the link when it has discovered th...

Custom Object calling Methods with setTimeout loses scope

I'm having an issue with building a Javascript object, and calling methods within that object using setTimeout. I've tried various workarounds, but always during the second part of my loop the scope becomes the window object rather than my custom object. Warning: I'm pretty new at javascript. my code: $(function() { slide1 = Object...

Change field field value on click

I want to supply the user with 3 images, each image will have an associated value: 1. left,middle,right 2. middle,left,right 3. left,right,middle I then want to write that value to the text field in a form, so it gets saved when the user clicks submit. I already have a working form where the user can type in values, 1,2 or 3 but want...

Open web directory to simple webpage

This is a fairly simple problem, I'm just not sure exactly how to approach it. A friend of mine has an open directory on his webserver, and he asked me to make a simple webpage for him which would just display all of the file names, rather than the dates/file sizes/etc. The page would also update when a new file is added into the direct...

scriptaculous-like component to avoid double-submit

Hi, I'm looking for a script to prevent the user from hitting the submit button twice specially for long time background processing forms. I'd like to implement something not just functional but visually appealing too. Can anybody share some tips of how to accomplish this using, for instance, scriptaculous ? Thanks ...

Looping Through Multiple JSON Requests (YouTube Data API)

Part of a website I am working on is a video page. I am pulling the videos from a YouTube account by accessing the YouTube Data API. Grabbing the videos in no particular order and not sorted works fine, but when I try to sort them into categories, I start running into trouble. Let's say there are three categories, Fruit, Vegetable, Pets....

string to json and check json key -value

{"loggedin":0,"error_message":"login_failed","success_message":"","username":"","sessionId":""} this my json in string format, i have to check in javascript that loggedin value 0 or 1 ...

Running a function on a dynamically added class

I have a button that when clicked inserts a form input field and a button (to delete) into the form using JQuery .after(). This works fine. The button that is inserted has a function .click that should run when it is clicked - it is not working. <script type="text/javascript"> $("#addAQuestion").click(function(){ var be...

jQuery - DatePicker showing up on top of text input field.

I have a form with a TextField for entering a date. I have a DatePicker "set" on this field. However, it appears on top of the field. I do not want it to obscure the text field. How do I go about doing this? ...