javascript

Mootools: How to Disallow `var drag` depending on `checkbox` checked?

Mootools: How to Allow and Disallow var drag depending on checkbox checked or not? window.addEvent('domready',function() { var z = 2; $$('#dragable').each(function(e) { var drag = new Drag.Move(e,{ grid: false, preventDefault: true, onStart: function() { e.setStyle('z-index',z++); } }); }); ...

websocket handshake problem

I'm using python to implement a simple websocket server. The handshake I'm using comes from http://en.wikipedia.org/w/index.php?title=WebSockets&amp;oldid=372387414. The handshake itself seems to work, but when I hit send, I get a javascript error: Uncaught Error: INVALID_STATE_ERR: DOM Exception 11 Here's the html: <!doctype htm...

Using JQuery to dynamically resize a 2-column HTML page causes infinite cycle on IE6.5

I am writing a web page that has a vertical menu bar on the left hand side and a main content pane on the right. I used CSS floats to accomplish this, but when the page is resized, the content can get "pushed under" the menu. To correct this, I used jQuery to dynamically resize the content pane, and it seemed to work well in FF3, Chrom...

Mootools: How to get `morpha.start()` after 2sec `mouseenter`?

Mootools: How to get morpha.start() after 2sec mouseenter? window.addEvent('domready',function() { var morph = new Fx.Morph('resize',{duration:700,delay:400}); $$('#resize').addEvent('mouseenter',function(e){ e.stop(); morpha.start({ width: '200px', height: '100px' }); }//It does not work on adding ',2000' he...

Cancel UIAlert Javascript Prompt automatically in UIWebView

I have a UIWebView that loads and I get hit with Javascript Prompt/UIAlertView that I would like to hit Cancel on automatically... The last method that gets called is: webViewDidStartLoad and won't proceed until I manually click Cancel or OK on the alert. Can anyone help me dismiss it automatically??? I very much appreciate it! Thank...

Change image alt with Javascript onlick

I have a thumbnail image that when clicked changes a larger image on the page. I have that part of the code working by just changing the .src with onclick. Is there also a way to change the alt and title attributes with onclick? ...

JavaScript pattern for multiple constructors

I need different constructors for my instances. What is a common pattern for that? ...

Do I need (Spring) MVC if I have Javascript/CXF?

I am developing a Java web services application that is (mostly) to be used by other SOA clients. Currently I am planning on using CXF to publish my various web services & methods using SOAP/XML. I am now being asked to investigate a thin client web-application for this tool. I have been looking into Javascript libraries such as ExtJS ...

jQuery - call a function anytime a user changes any form input?

I have a page that has multiple forms. Anytime the user clicks an input or modifies text in an input I would like a function to be called. Any ideas on how to do this efficiently and in a way where it doesn't require the form IDs? ...

Javascript: should I be hiding my implementations?

As a C# programmer, I have a bit of a habit of making things private that can and should be private, and I always get a weird feeling when a JS type exposes all its private parts to me (and that feeling is not 'aroused'). Say I have a type that has a draw method, which internally calls drawBackground and drawForeground, which make no sen...

Alternative to Fiddler ?

Hi I use Fidder to test bug fixes directly on non development environments. It allows you to intercept the bogus javascript file and replace it by any other content you specify without needing to deploy any files. The problem is that I just use this feature from Fiddler, and the interface is not very user friendly (specially if you need...

How to pop up an alert box when the browser's refresh button is clicked?

If the user refreshes the page in question it will add another record to the database, so I want to warn the user through an alert box if they really want to refresh the page and if they click ok then the page should be refreshed otherwise if they click cancel it won't be. How to make this type of alert box appear when the browser's ref...

How to make my slider do something at every specified pixel interval?

Hi, I have a nice working slider script (no libraries used). I need a math concept that would allow the slider to perform a callback on a specified pixel interval. So for example, my slider is 300px wide, and I specify the interval=10, then when the user slides the handle, the callback should happen at pixel positions 10,20,30,40 and so...

Access URLs in the Window's History Object

Is there any way to randomly access the URLs in Javascript's History object in Safari? I'm writing an extension where I need to, on a specifically-formatted page request, capture the URL of the previous page. From what I've been able to find, the History object definition is non-standard across browsers. Safari only seems to expose its l...

Get selected text in textarea

I'd like to store selected text in a variable and then delete the selected text by pressing a button. Preferably with jquery but I don't mind basic javascript. Thanks in advance. UPDATE: Thanks George, I've tried the example that you pointed to stripping down the code to what I need but I can't get it to work on click for the button. ...

jQuery, change div height to automatically fill out remainder of screen if content isn't already larger

My site is structured roughly like this: ----------------- header ----------------- | | side| main | | ----------------- footer I'm trying to get my "main" div to take all of the remaining height on the screen (and resize during window resizing), so that "footer" is always au...

Javascript sorting to match SQL Server sorting

Can anyone point me towards a sorting algorithm in javascript that would sort the same way SQL Server does (for nvarchar/unicode columns)? For reference, my previous question about this behavior can be found here: http://stackoverflow.com/questions/3213717/sql-server-2008-different-sort-orders-on-varchar-vs-nvarchar-values Rather than ...

How to update div with a CKEDITOR?

I have a page on which I have a div that I need to be able to update with several different pieces of code. I'm using an onClick event in a different div, which calls a js function to load in the appropriate code. When I first bring up the page, the div has only one line: <textarea name="editor1" rows="35">&lt;p&gt;Edit Area.&lt;/p&gt...

Can a php proxy script call javascript functions like click?

Hello, I'm adding to a PHProxy script to GET a certain page and fills in required forms with cURL and some R.E. This page is usually submitted with a button. I'm not posting directly to a page because the other server uses an IIS server with an 'viewstate' variable that I can't seem to proxyify correctly without receiving viewstate err...

Generic JSON object

I have a generic JSON structure I want to put in to a JavaScript object. My JSON is like this { "rows": [ { "items": [ { "key": "foo1", "value": "bar1" } , { "key": "foo2", "value": "bar2" } ] } ...