tinycm view lib/functions.js @ rev 61
Tiny edits
author | Paul Issott <paul@slitaz.org> |
---|---|
date | Sat Feb 01 17:29:04 2014 +0000 (2014-02-01) |
parents | 7914154807bb |
children | d6f01c5019bb |
line source
2 // Insert HTML code into editor text area.
3 function addCode(code) {
4 document.forms["editor"]["content"].value =
5 document.forms["editor"]["content"].value += code;
6 document.forms["editor"]["content"].focus();
7 }
9 // Check form to avoid empty values and bad email.
10 function checkSignup() {
11 if(document.forms["signup"]["name"].value == "")
12 {
13 alert("Please enter your real name");
14 document.forms["signup"]["name"].focus();
15 return false;
16 }
17 if(document.forms["signup"]["user"].value == "")
18 {
19 alert("Please fill in your user name");
20 document.forms["signup"]["user"].focus();
21 return false;
22 }
23 var x=document.forms["signup"]["mail"].value;
24 var atpos=x.indexOf("@");
25 var dotpos=x.lastIndexOf(".");
26 if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length)
27 {
28 alert("Missing or not a valid email address");
29 return false;
30 }
31 }