]> matita.cs.unibo.it Git - helm.git/blobdiff - helm/on-line/javascript/utils.js
This commit was manufactured by cvs2svn to create branch 'start'.
[helm.git] / helm / on-line / javascript / utils.js
diff --git a/helm/on-line/javascript/utils.js b/helm/on-line/javascript/utils.js
new file mode 100644 (file)
index 0000000..7a52b7c
--- /dev/null
@@ -0,0 +1,36 @@
+function chopSlash(url)
+{
+  return url.slice(0,url.lastIndexOf('/'));
+}
+
+function getParam(name)
+{
+  var search = location.search;
+  search = search.slice(1);
+  var args = search.split("&");
+  var value = "???";
+
+  for (var i = 0 ; i < args.length ; i++) {
+     var couple = args[i].split("=");
+     if (couple[0] == name) value = couple[1];
+  }
+
+  if (value == "???") value = getDefaultParam(name);
+
+  return value;
+}
+
+function outputOption(doc, value, content, selected)
+{
+  doc.write("<option value=\"" + value + "\" ");
+  if (value == selected) doc.write("selected ");
+  doc.write(">" + content + "</option>");
+}
+
+function outputCheckbox(doc, onclick, content, checked)
+{
+  doc.write("<input type=\"checkbox\" onClick=\"" + onclick + "\" ");
+  if (checked) doc.write("checked");
+  doc.write(">" + content + "</input>");
+}
+