javascript

HTML designMode, move cursor programmatically using default keypress handlers

Although I already got an answer, I'll start a small bounty on this one. As the answer is that it is impossible, I'm searching for an alternative solution or some other suggestion. I'm making a very customized editor using the HTML designMode. In one situation, I want the default action of a keypress be accomplished twice when pressing ...

how to make html page detect enter key pressed?

Hello everyone, I am using VSTS 2008 + C# + .Net 3.5 + IIS 7.0 + ASP.Net to develop a web application. The web application has an aspx page called default.aspx. And I want to implement the effect that when user press the enter key of keyboard, it is the same effect of press button "Action". Any ideas how to implement? Here is the defau...

jQuery undefined

Getting a weird error on a site I am developing. Even looked back at last couple of sites to make sure there was no differences... and nope, can not see any. Getting an jQuery undefined error only in IE on the following page http://weesleekit.info/lotus/beta/ it's with regard to the easy slider part on the site, but have used easy slide...

Enable YouTube API on existing player

I have an embeded youtube video which I want the YouTube API applied. I add the url parameter using jQuery as follows (demo): $(document).ready(function(){ var obj = $('object'); obj.find('embed').attr('src', function(i,s){return s+'&enablejsapi=1&version=3'}) obj.find('param[name=movie]').attr('value', function(i,v){return v+'&enabl...

Javascript in Sql Server?

T-SQL is nice. But I need a more flexible scripting language in Sql Server like javascript. Can anyone help? ...

GWT javascript error in IE8

Using a couple of GWT controls in a very simple way ... however it isn't working properly in IE and I notice that there is a JavaScript error on the page. The GWT setup is a simple TabLayoutPanel taken directly from the example at its documentation page: http://google-web-toolkit.googlecode.com/svn/javadoc/2.0/index.html?com/google/gwt/...

Firefox extension, accessing the document

I am having trouble accessing the document in my firefox extension. I am trying to get *target*.addEventListener("DOMContentLoaded", Run.writeToFile(line.value), false); to work, however I keep getting errors no matter what I try for my target. I have very little understanding of all of this and have pretty much tried everything I could ...

How to stop loading a page after the request is sent?

Hi everyone I have an ASP.NET (C#) page that has a long load time (like 2 minutes). The user is presented with a little animation and a "please wait" message. If the user accidentally loads this page, they need to wait for it to load. My question is: Is there a way to stop the page load? Thank you ...

Using jQuery's getJSON() method

So I was reading through the code on Malsup's twitter plugin and I noticed he'd written his own method to handle jsonp but with timeouts and errors. I can only assume the built in jQuery method 'getJSON' doesn't have this functionality even though it clearly works fine. So, should I continue to use Malsups version in my projects where ...

Accessing a variable by reference in Javascript

Hi folks, I'm trying to pass a reference to a variable and then update the contents in javascript, is that possible? For example a simple (fail) example would be... var globalVar = 2; function storeThis ( target, value ) { eval(target) = value; } storeThis( 'globalVar', 5); alert('globalVar now equals ' + globalVar); This of co...

Collecting values from the part-AJAX form with PHP

I currently have a form with a dropdown box, and when the value in the dropdown changes, a PHP file with some more form elements get loaded via jQuery's $.ajax function into the main form. However when I submit the form (using just the non-AJAX way) the values from the 'ajaxed' area of the form are not included in the $_POST values. Do y...

How to pass a value from the serverside page to a function in .JS file in asp.net

I have to pass a string value from the server side page (.aspx.cs) to a function in .JS page. I need to call the function in JS page from server side page along with string as a parameter. Can anyone please help me by providing samples or ideas to solve this problem? ...

Fixed positioning for mobile browsers.

On the mobile site I'm building, I need the top header to stay fixed positioned. I am aware of the fixed position solution for Mobile Safari as seen here: http://doctyper.com/archives/200808/fixed-positioning-on-mobile-safari/ I tried it and it works well. However, I was wondering if there's a single solution that works for all major...

Using jqGrid with HTML5 local database

I would like to use jqGrid for a pretty large HTML5/SQLite application. All of the data will be local and I'll never be calling a server. I've build a pretty simple bridge class that sort of hijacks the normal server-client communication by setting the url to '#' capturing the changed data with afterSubmit but it is very, very hacky. Is ...

Load XML formatted files with different extension than .xml using XMLHttpRequest object

I have this code that loads an xml file using javascript: function getXmlDocument(sFile) { var xmlHttp, oXML; // try to use the native XML parser try { xmlHttp = new XMLHttpRequest(); xmlHttp.open("GET", sFile, false); // Use syncronous communication xmlHttp.send(null); oXML = xmlHttp.responseXML; } catch (e) { // c...

Calculating text selection offsets in nest elements in Javascript

The Problem I am trying to figure out the offset of a selection from a particular node with javascript. Say I have the following HTML <p>Hi there. This <strong>is blowing my mind</strong> with difficulty.</p> If I select from blowing to difficulty, it gives me the offset from the #text node inside of the <strong>. I need the string ...

jQuery strategy question

I have migrated frameworks from prototype to jQuery in my Rails apps, and I'm running into a consistent problem which I need some advice on. Often times I'll use an AJAX function that updates a portion of the page. When this happens, any other Javascript I use that relates to the section of the page that was updated no longer works. ...

How can I get the smallest LatLngBounds that still contains a set of Lat/Long Coordinates in Google Maps JS API?

I need to plot a set of coordinates on the map in response to a user selection, and when it happens, I'd like to pan the map to focus on that set of points. How can I find the smallest bounding box (LatLngBounds) that contains all of the coordinates? ...

Change mousedown focus to a new div

So here's my code: function drawGridSquare(tableText) { gridSquare = document.getElementById('square'); gridSquare.innerHTML = tableText; document.body.appendChild(gridSquare); gridSquare.style.display = 'block'; gridSquare.style.top = e.pageY - gridSquare.offsetHeight ...

JavaScript regex to replace a character ignoring HTML tags

Hello everybody, Once again, I need some help and I appreciate you all for being here willing to help. I'm trying to implement a regex for a JavaScript function that will replace a string of text contained in an HTML tag, but ignoring the tag altogether. For example: The string I need to find and replace is the dollar sign ($), and the H...