javascript

How do I create a draggable and resizable JavaScript popup window?

I want to create a draggable and resizable window in JavaScript for cross browser use, but I want to try and avoid using a framework if I can. Has anyone got a link or some code that I can use? ...

Should I use Google Web Toolkit for my new webapp?

I would like to create a database backed interactive AJAX webapp which has a custom (specific kind of events, editing) calendaring system. This would involve quite a lot of JavaScript and AJAX, and I thought about Google Web Toolkit for the interface and Ruby on Rails for server side. Is Google Web Toolkit reliable and good? What hidden...

Is there an "exists" function for jQuery

So I know that you can do: if ($(selector).length>0) { // Do something } But is there a more elegant method? ...

Is there a lang-vb or lang-basic option for prettify.js from Google?

Visual Basic code does not render correctly with prettify.js from Google. on Stack Overflow: Partial Public Class WebForm1 Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'set page title Page.Title = "Something" End Sub End Class in...

How can I return a variable from a $.getJSON function

I want to return StudentId to use elsewhere outside of the scope of the $.getJSON() j.getJSON(url, data, function(result) { var studentId = result.Something; }); //use studentId here I would imagine this has to do with scoping, but it doesn't seem to work the same way c# does ...

Javascript Animation with Safari

I'm trying to create web applications that use Javascript. I'd like to be able to use animation in these applications. I've tried to use basic Javascript, but I've decided that the best thing to do is to use a library (such as YUI or JQuery). I'm running into a problem. On Safari, when I run animation scripts, the animation is very c...

How to control layer ordering in Virtual Earth

I have a mapping application that needs to draw a path, and then display icons on top of the path. I can't find a way to control the order of virtual earth layers, other than the order in which they are added. Does anyone know how to change the z index of Virtual Earth shape layers, or force a layer to the front? ...

How to plot a long path with Virtual Earth

The obvious way to plot a path with virtual earth (VEMap.GetDirections) is limited to 25 points. When trying to plot a vehicle's journey this is extremely limiting. How can I plot a by-road journey of more than 25 points on a virtual earth map? ...

Anyone have a diff algorithm for rendered HTML?

I'm interested in seeing a good diff algorithm, possibly in Javascript, for rendering a side-by-side diff of two HTML pages. The idea would be that the diff would show the differences of the rendered HTML. To clarify, I want to be able to see the side-by-side diffs as rendered output. So if I delete a paragraph, the side by side view wo...

What's the simplest way to decremement a date in Javascript by 1 day?

I need to decrement a Javascript date by 1 day, so that it rolls back across months/years correctly. That is, if I have a date of 'Today', I want to get the date for 'Yesterday'. It always seems to take more code than necessary when I do this, so I wonder if there's a simple way. What's the simplest way of doing this? [Edit: Just t...

ASP.NET AJAX: Firing an UpdatePanel after the page load is complete

I'm sure this is easy but I can't figure it out: I have an ASP.NET page with some UpdatePanels on it. I want the page to completely load with some 'Please wait' text in the UpdatePanels. Then once the page is completely loaded I want to call a code-behind function to update the UpdatePanel. Any ideas as to what combination of Javascr...

Force JavaScript file refresh on client

We are currently working in a private Beta and so are still in the process of making fairly rapid changes, although obviously as usage is starting to ramp up, we will be slowing down this process. That being said, one issue we are running into is that after we push out an update with new JavaScript files, the client browsers still use t...

Alternative "architectural" approaches to javaScript client code?

How is your javaScript code organized? Does it follow patterns like MVC, or something else? I've been working on a side project for some time now, and the further I get, the more my webpage has turned into a full-featured application. Right now, I'm sticking with jQuery, however, the logic on the page is growing to a point where some o...

How do I find the the exact lat/lng coordinates of a birdseye scene in Virtual Earth?

I'm trying to find the latitude and longitude of the corners of my map while in birdseye view. I want to be able to plot pins on the map, but I have hundreds of thousands of addresses that I want to be able to limit to the ones that need to show on the map. In normal view, VEMap.GetMapView().TopLeftLatLong and .BottomRightLatLong retur...

How can I set breakpoints in an external JS script in Firebug

I can easily set breakpoints in embedded JS functions, but I don't see any way of accessing extarnal JS scripts via Firebug unless I happen to enter them during a debug session. Is there a way to do this w/o having to 'explore' my way into the script? @Jason: This is a good point, but in my case I do not have easy access to the script. ...

Javascript Unit-testing?

What's the best way to go about running unit tests for Javascript? I've been playing around with Selenium IDE, but it's Firefox-specific. Selenium RC looks... difficult - but is it the best way to run tests in, say, IE6? Also, is it worth doing? I haven't seen much about automated tests for Javascript applications, but it seems to me...

How can I resize a swf during runtime to have the browser create html scrollbars?

I have a swf with loads text into a Sprite that resizes based on the content put into - I'd like though for the ones that are longer than the page to have the browser use its native scroll bars rather than handle it in actionscript (very much like http://www.nike.com/nikeskateboarding/v3/...) I did have a look at the stuff nike did but ...

Setting the height of a DIV dynamically

In a web application I'm working on, I have a page that contains a DIV that has an auto-width depending on the width of the browser window. However, I need to be able to have an auto-height for the object. The DIV starts about 300px from the top screen, and it's height should make it stretch to the bottom of the browser screen. I have...

How Do Sites Suppress Pasting Text?

I've noticed that some sites (usually banks) suppress the ability to paste text into text fields. How is this done? I know that JavaScript can be used to swallow the keyboard shortcut for paste, but what about the right-click menu item? ...

Communicating between websites (using Javascript or ?)

Here's my problem - I'd like to communicate between two websites and I'm looking for a clean solution. The current solution uses Javascript but there are nasty workarounds because of (understandable) cross-site scripting restrictions. At the moment, website A opens a modal window containing website B using a jQuery plug-in called jqModa...