javascript

How to disable browser postback warning dialog

I have an asp.net application that runs exclusively on IE7 (internal web site). When a user needs to enter data, I pop up a child window with a form. When the form closes, it calls javascript:window.opener.location.reload(true) so that the new data will display on the main page. The problem is that the browser complains that it must re...

Close mootools Rokbox through Javascript

I am using the mootools based Rokbox plugin, on one of my sites, and I can't figure out how to close it with javascript. I triggered the click event on the close button, but that did not work. I found the code in the rokbox source that is used to add the click listener this.closeButton.addEvent('click',function(e){new Event(e).stop();...

Infragistics WebTextEdit - Setting value in Javascript function

Hi all. I'm currently using the Infragistics component set for .Net 2.0, Visual Studio 2005 and C#. I have the following chunk of javascript code (text and other variables are declared elsewhere): ***alert(box[select].value); text.value(box[select].value); alert(text.value);*** 'text' is an Infragistics webTextEdit, whi...

How can you run Javascript using Rhino for Java in a sandbox?

Part of our java application needs to run javascript that is written by non-developers. These non-developers are using javascript for data formatting. (Simple logic and string concatenation mostly). My question is how can I setup the execution of these scripts to make sure scripting errors don't have a major negative impact on the rest...

Adobe ExtendScript development - How different than regular JavaScript?

Question I'm wondering how different ExtendScript is from JavaScript? Could I theoretically hire a web developer who has JavaScript savvy to develop it without demanding an excessive amount of learning on their part? Overview I'm working on a media database (or a so-called "multimedia library") project and it is based on XMP (the eXte...

Convert character to ASCII code in Javascript

How can I convert a character to its ASCII code using Javascript? For example, to get 10 from "\n". ...

JavaScript's document.write Inline Script Execution Order

I have the following script, where the first and third document.writeline are static and the second is generated: <script language="javascript" type="text/javascript"> document.write("<script language='javascript' type='text/javascript' src='before.js'><\/sc" + "ript>"); document.write("<script language='javascript' type='text/javascrip...

Using the javax.script package for javascript with an external src attribute

Say I have some javascript that if run in a browser would be typed like this... <script type="text/javascript" src="http://someplace.net/stuff.ashx"&gt;&lt;/script&gt; <script type="text/javascript"> var stuff = null; stuff = new TheStuff('myStuff'); </script> ... and I want to use the javax.script package in ja...

JQuery create select list options from JSON, not happening as advertised?

How come this doesn't work (operating on an empty select list <select id="requestTypes"></select> $(function() { $.getJSON("/RequestX/GetRequestTypes/", showRequestTypes); } ); function showRequestTypes(data, textStatus) { $.each(data, function() { var option = new Option(thi...

What is the best method to detect offline mode in the browser?

I have a web application where there are number of Ajax components which refresh them selves every so often inside a page (its a dashboard of sorts). Now, I want to add functionality to the page so that when there is no Internet connectivity, the current content of the page doesn't change and a message appears on the page saying that th...

What debug logging tools are available from Javascript?

I'd like to create a "universal" debug logging function that inspects the JS namespace for well-known logging libraries. For example, currently it supports Firebug's console.log: var console = window['console']; if (console && console.log) { console.log(message); } Obviously, this only works in Firefox if Firebug is installed/enabl...

Simplest way to update a client-side javascript array variable during a ASP.NET AJAX postback in an UpdatePanel?

If I want to inject a globally scoped array variable into a page's client-side javascript during a full page postback, I can use: this.Page.ClientScript.RegisterArrayDeclaration("WorkCalendar", "\"" + date.ToShortDateString() + "\""); to declare and populate a client-side javascript array on the page. Nice and simple. But I want to ...

What tools and techniques do you use to fix browser memory leaks?

I am trying to fix memory leaks in IE 7. Using Drip for investigations but it is not helping much when most dynamically generated DOM elements do not have unique ids. Tips? ...

Why does an onclick property set with setAttribute fail to work in IE?

Ran into this problem today, posting in case someone else has the same issue. var execBtn = document.createElement('input'); execBtn.setAttribute("type", "button"); execBtn.setAttribute("id", "execBtn"); execBtn.setAttribute("value", "Execute"); execBtn.setAttribute("onclick", "runCommand();"); Turns out to get IE to run an onclick on...

How to dynamically change the "src" or "data" for a PDF Object / Embed file using JavaScript?

I have a web application that is dynamically loading PDF files for viewing in the browser. Currently, it uses "innerHTML" to replace a div with the PDF Object. This works. But, is there a better way to get the ID of the element and set the "src" or "data" parameter for the Object / Embed and have it instantly load up a new document? I...

How to check if a variable is an object in Javascript?

I would like to see if a certain object has been loaded, if not, i want to load it like this: if (!isObjectLoaded(someVar)) { someVar= loadObject(); } ...

Automated Unit Testing with JavaScript

I'm trying to incorporate some JavaScript unit testing into my automated build process. Currently JSUnit works well with JUnit, but it seems to be abandonware and lacks good support for AJAX, debugging, and timeouts. Has anyone had any luck automating (with ANT) a unit testing library such as YUI test, JQuery's QUnit, or jQUnit (http...

Developing UI in JavaScript using TDD Principles

I've had a lot of trouble trying to come up with the best way to properly follow TDD principles while developing UI in JavaScript. What's the best way to go about this? Is it best to separate the visual from the functional? Do you develop the visual elements first, and then write tests and then code for functionality? ...

How do I split this string with javascript?

I have this string 'john smith~123 Street~Apt 4~New York~NY~12345' Using javascript what is the fastest way to parse this into var name = "john smith"; var street= "123 Street"; etc ...

How do you get the response from the Request object in MooTools?

How do you access the response from the Request object in MooTools? I've been looking at the documentation and the MooTorial, but I can't seem to make any headway. Other Ajax stuff I've done with MooTools I haven't had to manipulate the response at all, so I've just been able to inject it straight into the document, but now I need to mak...