javascript

Progressive Enhancement and Initial Display State

I have a specific example, but I'm looking for the answer in general as well. I have page elements that I want to have initially hidden if JavaScript is enabled. Examples: A section of a form that toggles A submit button for a select box 'jump form' I am trying to avoid the 'content flash' when the elements are hidden after page lo...

How to version files in the <HEAD> section?

I have seen on various websites how developers version their css/javascripts files by specifying querystrings similar to: <head> <link rel="stylesheet" href="css/style.css?v=1"> <script src="js/helper.js?v=1"> </head> How is that done? Is it a good practice? I've been searching around but apparently, I'm not looking for the ri...

Google Maps API v3: Is there a callback or event listener for a setMap() event?

I am using Google Maps API v3 on a website I am developing. I have a drop-down box beneath my map which allows the user to switch between different sets of markers to be displayed on the map. Each marker is displayed using marker.setMap(). My problem is that the map sometimes takes a long time to display the new markers, especially in I...

Password hashing (non-SSL)

How is the password sent from browser to server in case of non-ssl transfer? I want to use bcrypt to hash password+salt before sending.... but it seems there is no javascript implementation for the bcrypt algorithm... is md5, SHA-1 good enough? PS: My site does not store any user personal information.. I just want that user intended ...

datatable styleing css

I want to style my datatable using ThemeRoller . already enabled jQuery UI ThemeRoller support in my datatable. I have only one row on the top and the Pagination numbers are styled fine. but i dont see any style on the rows, they are all the same. Is that the default setting or i am missing something. $(document).ready(function(){ $("...

Converting a Java object to a Javascript object using velocity

Hi, If a have a Java object (lets say a User object), and I use velocity to template the page so I can access a field in the user object like ${user.id}, is there an easy way to convert this into a javascript object (so I can access the fields of the User object)? I can assign a value to javascript variable like var id = "${user.id}...

Dojo fileuploader without AJAX

I want to use Dojo to be able to style the upload input, since the browser will not allow CSS to style it. Currently I can only get the FileUploader to work as AJAX, and this is not desired because it needs to be passed with other form data. Is it possible to do this with Dojo? Or should I just write my own transparent file input and s...

jQuery - Disable HTML Page until .load calls is done.

What is the easiest way to disable an entire HTML page until an initial .load call is complete? What I mean by disable is the user can not interact with it in any way. It is ok for them to navigate away. I am using jQuery 1.2.6. Is it to set the call to be sync instead of async? how do you set options for this on the .load function? U...

What are the use cases of Node.js vs Twisted?

Assuming a team of developers are equally comfortable with writing Javascript on the server side as they are with Python & Twisted, when is Node.js going to be more appropriate than Twisted (and vice versa)? ...

What is a good javascript library to deal with parsing XML strings into nodes and back?

The codebase keeps files in XML format and javascript receives them via ajax and currently manually parses them into element nodes by doing the "div.innerHTML" trick, but this fails in fringe cases. Is there a javascript library with a lot of XML capabilities already built in? ...

Running Javascript after a ASP.NET postback from a client script block injected from a master page

I cannot get Javascript to run after a ASP.NET postback from a client script block injected from a master page Below is my master page logic, and it gets hit on a postback, I have confirmed with a breakpoint. namespace MyAwesomeProjectThatWillTakeOverTheWorldIfNotForThisIssue { public partial class CommonContent : MasterPage { ...

JQuery Restricting Date Range Based on Dropdown

I'm using the JQuery DatePicker to have the user pick a date and have that show up in a textbox. Easy enough. However a restriction I'm working on is that the date range is restricted based on the month that's currently picked out in a user dropdown menu to the month beginning and end dates. So for example if someone selects "Aug/2010" ...

Twitter Hovercards in GWT PagingScrollTable

How do you implement Twitter Hovercards in GWT PagingScrollTable? The Hovercard links work fine when, say, I add new Label("@ded") to a HorizontalPanel. However the Twitter JavaScript function doesn't seem to apply when I put "@ded" into a PagingScrollTable row. I'm a JavaScript newbie. In response to Igor's request, here's some more...

AutoTab javascript function problem

Hello All, we've run into an issue with this while using it in our asp.net application. The purpose of it is as follows: When in a textbox -> tab once MaxLength is reached When in a checkbox -> tab once the control is toggled with the keyboard (spacebar) Asides from buttons, those are the only controls on the form. The function is...

Javascript: Edit a preview with jquery

I have 2 divs, the first one has the label with the content to show, but when you click the "edit" button, it should show you the div="edit" and the content of the 1st label inside of the input that is linked to it (same id). By the other way, I saw sites that when you type something inside that input, the original label of the "preview...

How could I apply the class or the style to some HTML element in IE?

I'm doing an application that has to parse elements in an XML tree to HTML and in all the browsers it goes well but IE doesn't want to apply the styles to the elements. How could I fix this? function add2Doc(elmnt, domDoc, newEl) { /* * This function transform an * element to into the an acceptable * part of another ...

Cannot make unique javascript object. What's wrong with this code?

I'm trying to make a simple in in-page popup called like this: var test = new popObject({}); //JSON options and I'm having trouble because when I create two in a row, and call show() on the first one, the second one always shows. Both are created, but they aren't separate somehow, despite being called with new. What am I doing wrong h...

ERB doesnt get executed in javascript scripts

Hi guys I have a select input on my page. this select input displays/hides fields in the form. This all works fine. But the problem is that if i submit the form and lack some necessary fields, it doesnt set the select to the right value afterwards. I just cant get the embedded ruby to work! it keeps escaping the whole thing... here my c...

Javascript: Update label content while typing inside of a parent input with Jquery

How to update with jquery the label of preview div when im typing inside of the parent input of edit div? Thank you. <html> <body> <div id="preview"> <label id="companyName" class="workExperience"> This is my company </label> ...

How to detect whether UA is capable of displaying content inline

Browsers can display certain media inline, and will provided they are sent with content-disposition: inline. What's the best way to detect whether the browser is capable of doing so with a particular type of media? I am running into the question lately with PDFs and Mac/FF, which seems to refuse to display PDFs inline (actually, in iFra...