]> matita.cs.unibo.it Git - helm.git/blob - helm/on-line/javascript/utils.js
This commit was manufactured by cvs2svn to create branch 'start'.
[helm.git] / helm / on-line / javascript / utils.js
1 function chopSlash(url)
2 {
3   return url.slice(0,url.lastIndexOf('/'));
4 }
5
6 function getParam(name)
7 {
8   var search = location.search;
9   search = search.slice(1);
10   var args = search.split("&");
11   var value = "???";
12
13   for (var i = 0 ; i < args.length ; i++) {
14      var couple = args[i].split("=");
15      if (couple[0] == name) value = couple[1];
16   }
17
18   if (value == "???") value = getDefaultParam(name);
19
20   return value;
21 }
22
23 function outputOption(doc, value, content, selected)
24 {
25   doc.write("<option value=\"" + value + "\" ");
26   if (value == selected) doc.write("selected ");
27   doc.write(">" + content + "</option>");
28 }
29
30 function outputCheckbox(doc, onclick, content, checked)
31 {
32   doc.write("<input type=\"checkbox\" onClick=\"" + onclick + "\" ");
33   if (checked) doc.write("checked");
34   doc.write(">" + content + "</input>");
35 }
36