Recent Notes
Displaying keyword search results 1 - 7
Created by Dr. Xi on August 31, 2008 20:43:44
Last update: January 22, 2011 12:48:08
It's probably more useful to make the JavaScript executor a bookmarklet. That way it gains access to the page on which it is invoked. Therefore, more helpful while debugging. Here's the code:
<html>
<body>
<a href="javascript:(funct...
Or, you can add this link to your bookmarks, name it "JS Executor". For a full featured JavaScript console, you may need Jash
Created by James on June 30, 2010 19:04:45
Last update: July 03, 2010 21:24:33
Technically, file upload cannot be handled by Ajax, because XMLHttpRequest (XHR) does not handle file inputs. All techniques not using Flash rely on an invisible iframe as the upload form submit target. JavaScript then grabs the response content from the iframe and present it, giving the same illusion as Ajax. webtoolkit AIM The technique by webtoolkit is very simple. It involves 3 simple steps: include the AIM script, implement the start/finish JavaScript functions, and add an onsubmit handler to the normal file upload form. The hooked up form looks like:
<head> <script type="text/javascript" src="webt... The AIM script is also quite simple: /** * * AJAX IFRAME METHOD (AIM) * http... The above code only supports HTML responses. In order to support JSON responses, the above...
Created by James on June 30, 2010 20:14:28
Last update: July 03, 2010 18:41:12
The HTML page
<!DOCTYPE html>
<html>
<head>
<title>jQu...
Client Side Code
// called before upload submit
function sta...
Server Side Code
Using Apache Commons FileUpload as example.
Upload code (responds to fileUpload.do ):
final HttpSession session = httpServletRequest...
Progress code (responds to uploadProgress.do ):
HttpSession session = httpServletRequest.getSe...
Created by James on July 05, 2009 02:21:15
Last update: July 05, 2009 02:25:20
This is a JavaScript wrapper for Bare Naked App's progress bar.
As usual, download their images and add this to the CSS:
img.progressBar {
background: white url(images...
Then, add my JavaScript function, which takes a parent HTML element as input and returns the progress bar object with a setValue method:
function createProgressBar(elem) {
var img = d...
Test code:
<html>
<head>
<!-- setup code START -->
...
Created by Dr. Xi on March 02, 2009 23:29:08
Last update: March 28, 2009 21:35:41
An HTML form contains more than what meets the eye. This bookmarklet displays information about form fields in the page. When there are multiple forms on the page, successive invocations of the bookmarklet display each form in turn. Add this link to your bookmarks.
Here's the code:
<html>
<body>
<a href="javascript:
i...
Created by Dr. Xi on January 30, 2009 16:57:12
Last update: January 30, 2009 17:25:36
The scriptable attribute defaults to false . However, even when you set it to true , there is a time delay between when the applet is loaded and when it becomes scriptable . The following code may fail:
<html><body>
<object classid="clsid:8AD9C840-04...
You need to wrap the JavaScript like this:
<script language="JavaScript" type="text/javascrip...
Created by Dr. Xi on October 01, 2007 22:26:33
Last update: October 01, 2007 22:27:51
Main window code:
<html>
<body>
<script language="JavaS...
Child window code:
<html>
<script language="JavaScript">
...
In the parent window, it's important to return false from the onclick handler - to avoid the form from being submitted.
Of course, there are sexier ways to do the trick. But you may want to do it this way for the sake of being consistent, for example.