22 June 2011

Lists using HTML and JavaScript

After browsing the web for ages on trying to work out how to do expansions of lines for excel, I gave up. It seems it is easy to expand rows but to do automatically is not. So I moved on to html. Someone directed me to W3schools as a recommendation, I do recommend it. Anyway lists, I am going to use the same example as last time.

<h2>Physica Module </h2>
Should the processes be timed and printed at the end of the run?
<select name="Runtime" id="Physica.Runtime">
<!--default is off-->
<option value="OFF">OFF
<option value="ON">ON
<button type="button" onclick="PhysicaModule()">
<p id="Runtime Output"> </p>

<script type="text/javascript">
function PhysicaModule()
txt=document.getElementById("Physica.Runtime").name+" "+ document.getElementById("Physica.Runtime").value;
document.getElementById("Runtime Output").innerHTML=txt;

the idea is there is dropdown list with two options "ON" and "OFF" and a button underneath called submit. underneath that is a paragraph where we put the results from clicking the button into (at the moment i haven't worked out how to get it into a txt file). Then a bit of javascript that determines what happens when the button is pressed. which hopefully we say "Runtime ON" or "Runtime OFF" depending on what option you choose.

Physica Module

Should the processes be timed and printed at the end of the run?

If the above bit of code doesn't work do it for yourself just remember to put <HTML> at the beginning and </HTML> at the end.

No comments:

Post a Comment