云笺根据名字打开目录

例如:test test_ test_2 打开的都是 test 的目录

1
2
3
4
5
6
7
8
9
10
11
12
13
14
function openContent() {
var name = document.getElementById("name").value;
if (name == "") return ;
var url = "", pat = /(.+_)\d{1,2}/;
if (pat.test(name)) // 符合正则
url = name.slice(0, name.lastIndexOf('_')+1); // "_" 左边及其内容
else if (name.lastIndexOf('_') == name.length-1) // 以 "_" 结尾
url = name;
else
url = name + "_";

window.open("index.php?n=" + encodeURI(url));
return false;
}

打开下一页

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function page_next() {
var name = document.getElementById("name").value;
if (name == "") return ;
var url = "";
var pat = /(.+_)\d{1,2}/;
if (pat.test(name))
{
url = name.slice(0, name.lastIndexOf('_')+1);
pagenum = name.slice(name.lastIndexOf("_")+1, name.length); // 获取页码
pagenum = parseFloat(pagenum) + 1;
url = url + pagenum;
}
else if (name.lastIndexOf('_') == name.length-1)
url = name + "1";
else
url = name + "_1";

openYunj2("index.php?n=" + encodeURI(url));

return false;
}