javascript

Activating OnBeforeUnload ONLY when field values have changed

Hey guys, What I'm trying to achieve is to Warn the user of unsaved changes if he/she tries to close a page or navigate away from it without saving first. I've managed to get the OnBeforeUnload() dialog to pop-up... but I don't want it to be displayed at all if the user hasn't modified any field values. For this, I'm using this hidd...

Openstreetmap: embedding map in webpage (like Google Maps)

Is there a way to embed/mashup the OpenStreetMap in your page (like the way Google Maps API works)? I need to show a map inside my page with some markers and allow dragging/zooming around, maybe routing. I suspect there would be some Javascript API for this, but I can't seem to find it. Searching gets me an API for access to raw map da...

BEST Javascript editor/IDE with intellisense and debugging(possibly) ?

Which javascript editor is good ? I need intellisense support for cusotm javascript code as well ? If it supports debugging that'll be a great value add, of course I need it. Searched too much on the internet, found a few but did not work for me. Can you please suggest a good javascript editor ? ...

how to get lastSibling by javascript?

There is a native "nextSibling" attribute,but how to get "lastSibling"? ...

How is the default submit button on an HTML form determined?

If a form is submitted but not by any specific button, such as by pressing Enter using HTMLFormElement.submit() in JS how is a browser supposed to determine which of multiple submit buttons, if any, to use as the one pressed? This is significant on two levels: calling an onclick event handler attached to a submit button the data s...

Finding matching inner text in HTML controls and changing its format using JavaScript

I am generating a page which renders a list of linkbuttons and labels. Now I want a javascript that parses the inner text of these controls and makes bold those with keywords that match like Google does while rendering a list of websites with linkbutton and its description. How should i proceed ? ...

Adding onLoaded handler for Silverlight via HTML

Hi guys, I am not a pro in Silverlight 2.0, but for those who are, is it possible to add an event handler for the Silverlight host via javascript in an HTML file. In short, is it possible to add parameters to the object tags like these <param name="onLoaded" value="myjavascripthanderforloaded" /> <param name="onMouseEnter" value="myjava...

what is the correct way to determine that an AJAX call is successful?

what is the correct way to determine that an AJAX call is successful? I see in prototype.js return !status || (status >= 200 && status < 300); and in jQuery: // IE error sometimes returns 1223 when it should be 204 so treat it as success, see #1450 return !xhr.status && location.protocol == "file:" || ( xhr.sta...

Regular Expression String followed by digits in Javascript

I am getting myArray as null. Can anyone help me? myRe = new RegExp ("[A-Z]+(\\d+)"); myArray = myRe.exec("book1"); alert(myArray.length); ...

what's "this" in javascript onclick?

<a onclick="javascript:func(this)" >here</a> what does this mean in the script? ...

Implementing Tiny MCE As Local HTML Editor

UPDATE: There are stupid questions, and this is one of them. I didn't realize that serving JavaScript via Django was so large a question. When I've answered it, I'll post the most useful resources for those who want to RTFM, unless the mods close this first. Until then, sorry for wasting your time. How do I install and configure Ti...

IE problem: keyboard interaction with checkbox

I have an HTML table, and each row has a checkbox for selecting or deselecting its row. Whenever a checkbox changes value, I need to add or remove highlighting to the row and also ensure that the page's submit button is only enabled when at least one row is selected and disabled otherwise. The checkbox event handler is defined by the f...

How to use the jQuery Cycle Plugin with WordPress?

I have tried everything that I can think of. It shouldn't be this hard. Can some one please explain to me the process of using jQuery with WordPress (specifically jQuery Cycle Plugin)? in header.php I have: <?php wp_enqueue_script('jquery.cycle.all.min', '/wp-content/themes/andrewhavens/jquery.cycle.all.min.js', array('jquery')); ...

Why can't I tab between form elements within an iframe?

I have a page in a site that contains an iframe with a form in it. I can't change this but I do have full control over all of the JS that runs in the parent page and the iframe'd page. My problem is that when I have a form field focused in the iframe'd document, tabbing to the next field sends the cursor straight up to the address bar ...

Why don't I get a 'same origin policy' warning when using the Google Maps API?

I'm making a RESTful web service call in my JavaScript page and get the following warning: "This page is accessing information that is not under its control. This poses a security risk. Do you want to continue?" Now I've read up on this and am aware of the cross-domain, same origin policy. However, I don't get such warnings when I c...

what's the easiest method to append a TR to a table by javasript?

if the table id is known,so the table can be specified by docoument.getElementById(table_id), how can I append a TR element to that table in the easiest way? the TR is like follows: <tr><td><span>something here..</span></td></tr> ...

how to get formatted date time like 2009-05-29 21:55:57 using javascript?

when using new Date,I get something like follows: Fri May 29 2009 22:39:02 GMT+0800 (China Standard Time) but what I want is xxxx-xx-xx xx:xx:xx formatted time string ...

Update ValidationSummary list on control blurs?

A ValidationSummary will show a list of errors on postback. As each field is fixed, it's validator is fired, and any validation text will disappear. I want to automatically update the ValidationSummary as well. The following works fine: <asp:TextBox ID="ForenameTextBox" onblur="ValidationSummaryOnSubmit()" runat="server" /> but this ...

Detecting adobe flash version on IE7 - vista

It appears I'm not able to detect the installed version of flash on Vista/IE7. The following code fails: var x = new ActiveXObject('ShockwaveFlash.ShockwaveFlash'); The error I'm getting is: automation server cannot create object Looking at the Adobe Flash Detection Kit (from adobe), it looks like that's failing as well. I only h...

JScript syntax verifier?

I'm new to JScript coming from a C++ world. I'm quite surprised that expressions are evaluated at run-time. What I mean is if I added a function and didn't provide its definition, the program would "crash" (in the debugger) when I run it. It's also funny how I can just type gibberish anywhere and only at run-time the debugger would com...