--- /dev/null
+ <SCRIPT type="text/javascript">
+ /* <![CDATA[ // */
+// From http://snipplr.com/view.php?codeview&id=1272
+//----------------------------------------
+//Wrapper function for constructing a request object.
+// Parameters:
+// reqType: The HTTP request type, such as GET or POST.
+// url: The URL of the server program.
+// asynch: Whether to send the request asynchronously or not.
+//----------------------------------------
+
+function httpRequest(reqType,url,asynch,respHandle) {
+
+ // Mozilla-based browsers
+ if (window.XMLHttpRequest) {
+ request = new XMLHttpRequest();
+ } else if (window.ActiveXObject) {
+ request = new ActiveXObject("Msxml2.XMLHTTP");
+ if (!request) {
+ request = new ActiveXObject("Microsoft.XMLHTTP");
+ }
+ }
+
+ // Request could still be null if neither ActiveXObject
+ // initialization succeeded
+ if (request) {
+ // If the reqType param is POST, then the fifth arg is the POSTed data
+ if (reqType.toLowerCase() != "post") {
+ initReq(reqType, url, asynch, respHandle);
+ } else {
+ // The POSTed data
+ var args = arguments[5];
+ if (args != null && args.length > 0) {
+ initReq(reqType, url, asynch, respHandle, args);
+ }
+ }
+ } else {
+ alert("Your browser does not permit the use of all " +
+ "of this application's features!");
+ }
+
+}
+
+//----------------------------------------
+//Initialize a request object that is already constructed
+//----------------------------------------
+
+function initReq(reqType, url, bool, respHandle) {
+ try {
+ // Specify the function that will handle the HTTP response
+ request.onreadystatechange = respHandle;
+ request.open(reqType, url, bool);
+ // If the reqType param is POST, then the
+ // fifth argument to the function is the POSTed data
+ if (reqType.toLowerCase() == "post") {
+ // Set the Content-Type header for a POST request
+ request.setRequestHeader("Content-Type", "application/x-ww-form-urlencoded; charset=UTF-8");
+ request.send(arguments[4]);
+ } else {
+ request.send(null);
+ }
+ } catch (errv) {
+ alert("The application cannot contact the server at the moment. " +
+ "Please try again in a few seconds.\n" +
+ "Error detail: " + errv.message);
+ }
+}
+
+// jalview launching with fetched data
+
+function startJalview(aligURL,title,alwvar) {
+ var aligment = "";
+ httpRequest("get",aligURL,true,function() {
+ if (request.readyState == 4) {
+ alignment = request.responseText;
+ eval("var "+alwvar+" = document.JalviewLite.loadAlignment(alignment,title)");
+ }
+ })
+
+}
+
+/* ]]> */
+</SCRIPT>
+ <form name="Form1">
+<applet name="JalviewLite" code="jalview.bin.JalviewLite"
+archive="${content.jvl}" width="0" height="0">
+<param name="debug" value="true"/>
+<param name="showbutton" value="false"/>
+<#if (content.permissions?exists)>
+<param name="permissions" value="${content.permissions}"/>
+</#if>
+</applet>
+
+<h2>Javascript Launch Button</h2><p>The button below demonstrates how JalviewLite can be launched via a javascript action.</p>
+
+ <input type="button" name="Button1" value="Start"
+onClick="startJalview('plantfdx.fa','Button1.alignment','alwvar')"/>
+ </form>