Skip to content

Commit

Permalink
add javascript buttons for controlling the MW model
Browse files Browse the repository at this point in the history
  • Loading branch information
stepheneb committed Apr 21, 2010
1 parent 92a48cf commit eae22b5
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion mw_transcribe_applet2.html
Expand Up @@ -6,18 +6,36 @@
<link rel="stylesheet" href="stylesheet/test.css" type="text/css" />
<script type="text/javascript" src="javascript/library.js"></script>
<script type="text/javascript" src="javascript/jquery-1.4.js"></script>
<script type="text/javascript">
function sendCode(applet_id) {
var msg = runOTrunkAppletMWScript(applet_id, "mw2d:1:get DNA");
document.getElementById("code").innerHTML="DNA code: " + msg;
}
function receiveCode(applet_id) {
var x=prompt("Please enter DNA code:","")
runOTrunkAppletMWScript(applet_id, "mw2d:1:set DNA " + x);
}
function stopRKey(evt) {
var evt = (evt) ? evt : ((event) ? event : null);
var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
}
document.onkeypress = stopRKey;
</script>

</head>
<body>
<div id="main" class="page-content">
<h3 class="page-title namespace">MW Applet/Javascript reporting test</h3>
<div id="back" class="back"><a href="index.html">back</a></div>
<div class="report">
<p>This page embeds an instrumented applet version of Molecular Workbench which supports
logging of user interactions with model and scripted controls. </p>
<p>This particular model simulating dna transcription does not have any variables so the report
consists only of user ActionItems.</p>
</div>
<div class="section">
<div style="width:780px; height:240px margin:20px">
<div style="width:780px; height:300px; margin:20px; padding:10px">
<applet id="myapplet"
archive="
lib/mw-aspects.jar,
Expand All @@ -35,6 +53,15 @@ <h3 class="page-title namespace">MW Applet/Javascript reporting test</h3>
width="100%" height="240">
<param name="url" value="models/transcribe-cml.otml"/>
</applet>
<form style="margin-left:40px; padding:10px;">
<input type="button" value="Input DNA code" onclick="receiveCode('myapplet')">
<input type="button" value="Start" onclick="runOTrunkAppletMWScript('myapplet', 'mw2d:1:transcribe A;')">
<input type="button" value="A" onclick="runOTrunkAppletMWScript('myapplet', 'mw2d:1:transcribe A;')">
<input type="button" value="C" onclick="runOTrunkAppletMWScript('myapplet', 'mw2d:1:transcribe C;')">
<input type="button" value="G" onclick="runOTrunkAppletMWScript('myapplet', 'mw2d:1:transcribe G;')">
<input type="button" value="U" onclick="runOTrunkAppletMWScript('myapplet', 'mw2d:1:transcribe U;')">
<input type="button" value="Print DNA code" onclick="sendCode('myapplet')">
</form>
</div>
</div>
<div class="clearfix"/></div>
Expand Down

0 comments on commit eae22b5

Please sign in to comment.