/[suikacvs]/www/2005/uri/uri-script.js
Suika

Contents of /www/2005/uri/uri-script.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (hide annotations) (download) (as text)
Sun Mar 27 08:08:34 2005 UTC (19 years, 8 months ago) by wakaba
Branch: MAIN
CVS Tags: HEAD
File MIME type: application/javascript
New

1 wakaba 1.1 window.onload = function () {
2     document.getElementById ('SUBMIT').onclick = function () {
3     var uri_re = /^(([^:\/?#]+):)?(\/\/([^\/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;
4     var original_uri = document.getElementById ('INPUT-URI').value;
5     if (original_uri.match (uri_re)) {
6     setValue ('RESULT-URI-SCHEME', RegExp.$2, RegExp.$1);
7     setValue ('RESULT-URI-AUTHORITY', RegExp.$4, RegExp.$3);
8     setValue ('RESULT-URI-PATH', RegExp.$5, true);
9     setValue ('RESULT-URI-QUERY', RegExp.$7, RegExp.$6);
10     setValue ('RESULT-URI-FRAGMENT', RegExp.$9, RegExp.$8);
11     }
12     };
13     };
14    
15     function setValue (elID, val, isNonNull) {
16     var el = document.getElementById (elID);
17     if (!isNonNull) {
18     el.innerHTML = '−';
19     } else {
20     el.innerHTML = '';
21     var code = document.createElement ('code');
22     code.setAttribute ('class', 'URI');
23     code.appendChild (document.createTextNode (val));
24     el.appendChild (code);
25     }
26     }

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24