javascript

Drag'n'Drop and Paste detection with contentEditable or designMode enabled

Does anyone of you know a cross browser working way to detect paste or drag'n'drop inserts into an editable html document (with designMode or contentEditable enabled). Detecting paste works as long as the user uses the Ctrl-V shortcut as it generated key events, but if you use the browsers Edit->Paste no events are generated it seems. ...

Date picker calendar gets buried under the Drop Down List

Hi All... I downloaded a Datepicker from the net and modified it a little bit according to my need. It works fine, but I have a small problem. The calendar dropdown gets buried under the DropDown list that is just below the date picker. Click For Image Here Could you please help? Thanks ...

load javascript effects after ajax (js column sort for example)

I've found several js table column sorters that work great on regular html content: http://www.kryogenix.org/code/browser/sorttable/ http://www.allmyscripts.com/Table_Sort/index.html#how_to_use_it The first one works by assigning a class to a table. The second by passing the id of the table to a js constructor. I'm using jQuery to ha...

Javascript function involving use of regex

I am allowing a user to enter dimensions of a box through form fields. the permissible values are: positive integers must end with px or % Sample valid numbers are 300px or 70% In addition, I want to place some extra validation logic: If entered value is in percentage, then the number must lie in the range 0 > x <=100 If the numb...

Using JSON data in a javascript function

I am returing JSON data as a response in a web service I am writing. I am wondering what is the best way to consume the data, returned to a Javascript function (passed as an argument). Do I: use eval() use Doug Crawfords jSon parser to parse the JSON data into a Javascript object simply use the returned data as an object literal B...

How to evaluate Javacript within C#? (need to get all links for a web page, including java-script generated ones)

Hi, Background: I have to download webpages with their resources for offline viewing, however as part of this I have to "rewrite" the URL's for links with the HTML webpage so they work. This is fine more the standard types of links however I'm realizing now that there are some links that are dynamically created by javascript. Questi...

XML literals in JavaScript?

E4X (Ecma-357) is an extension to ECMAScript that adds XML literals as first-class primitives. That's awesome, but with only Mozilla and Adobe support (without V8 and IE support too), E4X is virtually dead from a web developer's perspective that has to support users with any modern browser. What other work is being done around implemen...

Triggering the refresh event in Internet Explorer

On a dynamic site of mine I faced a problem that consists in the following: In Internet Explorer 6 after changing the size of the div element with the help of JavaScript, its child elements that are 100% in height do not refresh right away (ie. do not stretch to their new size) but only when the parent div is clicked. It seems to me tha...

Testing if jQueryUI has loaded

I'm trying to debug a website, and I think that jQueryUI may not have loaded properly. How can I test if jQueryUI has loaded? ...

click links though javascript

Am looking for how to click links on my page using javascript. In my page i show each record from my database . and a 'show' link to the right clicking it will expand and display the row in detail. i want to expand all the rows at once . Is it possible to click link in Javascript like this? ...

Improving a simple JavaScript templating technique

I'm trying to develop a simple way of creating templates in JavaScript. The basic idea is that I've got HTML in a page that represents the UI of an object in JavaScript, and variables in that HTML that are replaced with properties of the JavaScript object. Think of it as technique for binding JavaScript objects to HTML presentations. A...

How can I implement Stack Overflow-like watermarks in forms?

Hey people. I remember seeing a tutorial somewhere that talks of how to style your input forms in a more “usable” way. Essentially, you have a placeholder value and when you enter the input, it hides the hint so to speak. Now, just to be clear: I don't want the hint (placeholder value text) to disappear on focus, but rather to go ligh...

Slicing or some other way to only write part of a Spry XML record

I'm trying to import items from a XML RSS feed and use Spry to show recent blog posts in a blog on a site. It works fine, but I want to show just the first 30 characters followed by an ellipsis. I can't seem to find a way to shorten the spry element since in the region, {description} will not be evaluated before the surrounding code so I...

How do I copy elements that include <script> children from an AJAX-loaded document?

I'm currently trying to hack a kind of edit-in-place functionality into the JIRA bugtracker without changing its page templates. So, on the detail page for an issue, I'm attaching dblclick events to fields that replace the static field with an editable form element (from the edit page, which has been ajax-loaded and cached at the beginni...

DOM node child collections--what's the difference?

What's the difference between the children and childNodes collections of a node? And childElementCount and childNodes.length? ...

How t make a href="#top" from iframe to parent window

hi I using parent window and one iframe my html code is given below Page1.html <html> <head> <meta http-equiv="Content-Language" content="en-us"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>New Page 1</title> </head> <body> <a name="logo" href="Page2.html">dsd</...

Loading Java applet with height set to 100%

Hello, I have an webpage that displays a java applet. The applet is resized if the window is resized using JavaScript which works fine. The width and height of the applet is set to 100%. When the applet is loading, an image is displayed image = "preloader.gif" Using IE 6/7 everything works fine. But in Firefox, the applet has a heig...

jquery/javascript caching question

hi all, i was wondering - when using jQuery (or any other javascript include) in my web, does the browser cache it after the first download for all all pages (i assume yes) or will it download it every time? 2nd, when the user quits the browser and starts it again (for loading my website), will the jquery js file still be cached or wil...

javascript: lightweight lightbox script

hi all, i'm looking for a lightweight javascript for displaying images the way lightbox does. it should be small + simple, no jquery/mootools plugin, no animations. i just should be able to display an image when clicking on its thumbnail. thanks ...

How do I remove the border around a focused contenteditable pre?

Hi, When I set a pre element to contenteditable and put focus in it for editing, it receives a dotted border around it that doesn't look very nice. The border isn't there when focus is somewhere else. How do I remove that border? Thanks ...