javascript

Is it possible to interpolate my angle bracket, percent, equals <%= %> syntax in external javascript files?

Often times when mixing jquery with asp.net I need to use asp .net angle bracket percent, <% %>, syntax within a jquery selector. If I would like to seperate the javascript from markup into different files is there still a way to evaluate my javascript file so the angle bracket percents are interpolated before reaching the client brows...

CSS/JavaScript Use Div to grey out section of page

Does anybody know a way with JavaScript or CSS to basically grey out a certain part of a form/div in HTML? I have a 'User Profile' form where I want to disable part of it for a 'Non-Premium' member, but want the user to see what is behind the form and place a 'Call to Action' on top of it. Does anybody know an easy way to do this eithe...

Find X/Y of an HTML element with Javascript

How can I find the X Y coordinates of an HTML element (DIV) from Javascript if they were not explicitly set? ...

Localization in OpenSocial gadget app

I'm trying to add multi-language support to an OpenSocial application. I see that I can link to my own message bundles in the gadget XML markup: <Module> <ModulePrefs title="Hello" description="Message bundle demo"> <Require feature="opensocial-0.7"/> <Locale lang="en" messages="http://example.com/hello/en_ALL.xml"/&gt; </...

Why move your Javascript files to a different main domain that you also own?

I've noticed that just in the last year or so, many major websites have made the same change to the way their pages are structured. Each has moved their Javascript files from being hosted on the same domain as the page itself (or a subdomain of that), to being hosted on a differently named domain. It's not simply parallelization Now, t...

ZIP Code (US Postal Code) validation

I thought people would be working on little code projects together, but I don't see them, so here's an easy one: Code that validates a valid US Zip Code. I know there are ZIP code databases out there, but there are still uses, like web pages, quick validation, and also the fact that zip codes keep getting issued, so you might want to us...

Run custom Javascript whenever a client-side ASP.NET validator is triggered?

Is there a way to run some custom Javascript whenever a client-side ASP.NET validator (RequiredFieldValidator, RangeValidator, etc) is triggered? Basically, I have a complicated layout that requires I run a custom script whenever a DOM element is shown or hidden. I'm looking for a way to automatically run this script when a validator i...

Syntax highlighting code with Javascript

What Javascript libraries can you recommend for syntax highlighting <code> blocks in HTML? (One suggestion per answer please). ...

What's a good Minimal Server-Side Javascript Framework?

So I was writing a web app with web.py that uses plenty of client-side javascript, and my database is on couchdb so the queries are in javascript too, and eventually I just got to thinking, why not skip the python and go all javascript? Besides, some functions need to run once on the client and again on the server to make sure you're no...

Adding and removing content in jQuery

If I create a function with jQuery that adds an empty div, performs some animation inside the blank space created by the div, then removes the div, the browser never makes room for the empty div (height and width are set). If I don't remove the empty div in my function, then the browser will create the needed space and everything works ...

Is JavaScript single threaded? If not, how do I get synchronized access to shared data?

I have a web page with DIVs with a mouseover handler that is intended to show a pop-up information bubble. I don't want more than one info bubble to be visible at a time. But when the user moves the mouse rapidly over two items, I sometimes get two bubbles. This should not happen, because the code for showing a pop-up cancels the previou...

Determining the height of an HTML table that is dynamically filled

Hi there, I would like to draw a diagram in HTML. The positioning structure looks like this: <div id='hostDiv'> <div id='backgroundDiv'> ... drawing the background ... </div> <div id='foregroundDiv' style='position: absolute;'> ... drawing the foreground ... </div> </div> The foreground contains a Table ...

JavaScript ClientSide vs. ServerSide Validation

Which is better to do client side or server side validation? In our situation we are using - jQuery and MVC. - jSon data to pass between our View and Controller. Alot of the validation I do is validating data as users enter it. For example I use the the keypress event to prevent letters in a text box, set a max number of character...

Building a web crawler - using Webkit packages

I'm trying to build a web crawler. I need 2 things: Convert the HTML into a DOM object. Execute existing Javascripts on demand. The result I expect is a DOM Object, where the Javascript that executes on-load is already executed. Also, I need an option to execute on demand additional Javascripts (on events like: onMouseOver, onMouseClick...

How to get the checked option in a group of radio inputs with JavaScript?

How to get the checked option in a group of radio inputs with JavaScript? ...

Rendered pIxel width data for each character in a browser's font

I have a table column that needs to be limited to a certain width - say 100 pixels. At times the text in that column is wider than this and contains no spaces. For example: a_really_long_string_of_text_like_this_with_no_line_breaks_makes_the_table_unhappy I would like to calculate the width of text server-side and add an ellipsis aft...

How do I call Java code from JavaScript code in Wicket?

If I can do this, how do I call Java code (methods for instance) from within JavaScript code, in Wicket. ...

Where can I find free content hosting?

Is there any free hosting for Javascript? Recently google has been hosting jQuery,etc... and Yahoo hosts it's YUI, which is great, but it'd be even better if there was a service that could host user scripts and things like that. Any ideas? ...

Can I pass parameter from different page?

In PHP it is easy to pass parameter using $_GET[] and $_POST[]. Is there something like that in JavaScript? I hope I can pass parameter from address or form. ...

Javascript Date() constructor doesn't work.

I have an issue - The javascript Date("mm-dd-yyyy") constructor doesn't work for FF. It works fine for IE. IE : new Date("04-02-2008") => "Wed Apr 2 00:00:00 EDT 2008" FF2 : new Date("04-02-2008") => Invalid Date So lets try another constructor: Trying this constructor Date("yyyy", "mm", "dd") IE : new Date("2...