<script>
function testA(){
var stack = new Array("a","b","c","d","e","f","g","h","i","j","k","l");
var buff = new Array();
function getComb(stack, buff)
{
if(stack.length + buff.length < 5) return; //字母不够了,不用再试
while(stack.length > 0) //字母还没用完
{
buff.push(stack.shift()); //选取字母
if(buff.length < 5) //还没到5个字母
{
getComb(stack.slice(0), buff.slice(0)); //继续选取
}
else if(buff.length == 5)
{
document.write(buff+"<br>"); //够数量了,输出
}
buff.pop(); //丢弃用过的字母
}
return;
}
getComb(stack, buff);
}
function testB(strA){
var buffer2 = new Array();
var initCount = 0;
var str = strA;
var countPoint = 0;
if(str.indexOf("+")>0||str.indexOf("-")>0||str.indexOf("*")>0||str.indexOf("/")>0){
for(var i=0; i<str.length;i++){
if(str.charAt(i)=='('){
countPoint = 1;
buffer1.push("(");
// alert("222222222222============"+buffer1.length);
}
if(str.charAt(i)==')'){
countPoint = i;
buffer1.pop("(");
// alert("222222222222============"+buffer1.length);
}
if(countPoint>0&&buffer1.length==0){
// alert("222222222222============"+buffer1.length);
countPoint=2;
}
if(countPoint==2){
buffer2.push(str.charAt(i+1));
countPoint = 0;
}
}
// buffer2.pop();
alert("3333333333========="+buffer2.toString());
}else{
alert("sdfffdfdsafdas");
}
}
function testA(){
var ste = document.all("aa").value;
alert(ste);
testB(ste);
}
var buffer1 = new Array();
var ra = 0;
var rb = 0;
var page = 0;
var tmpLength = 0;
var counterNum = 0;
var strddd = "";
function aa(){
testA();
if(counterNum==0){
tmpLength = tmpLength;
ra = dafd;
rb = dfd;
page = dfds;
strddd = daadfadf+buffer1[counterNum];
counterNum++;
}
if(ra == ca&& rb==cb&&page==pb){
strddd = daadfadf+buffer1[counterNum];
counterNum++;
}
}
</script>
<input type="text" name="aa" value="" />
<input type="button" name="dsd" value="测试堆栈" οnclick="testA()">
function testA(){
var stack = new Array("a","b","c","d","e","f","g","h","i","j","k","l");
var buff = new Array();
function getComb(stack, buff)
{
if(stack.length + buff.length < 5) return; //字母不够了,不用再试
while(stack.length > 0) //字母还没用完
{
buff.push(stack.shift()); //选取字母
if(buff.length < 5) //还没到5个字母
{
getComb(stack.slice(0), buff.slice(0)); //继续选取
}
else if(buff.length == 5)
{
document.write(buff+"<br>"); //够数量了,输出
}
buff.pop(); //丢弃用过的字母
}
return;
}
getComb(stack, buff);
}
function testB(strA){
var buffer2 = new Array();
var initCount = 0;
var str = strA;
var countPoint = 0;
if(str.indexOf("+")>0||str.indexOf("-")>0||str.indexOf("*")>0||str.indexOf("/")>0){
for(var i=0; i<str.length;i++){
if(str.charAt(i)=='('){
countPoint = 1;
buffer1.push("(");
// alert("222222222222============"+buffer1.length);
}
if(str.charAt(i)==')'){
countPoint = i;
buffer1.pop("(");
// alert("222222222222============"+buffer1.length);
}
if(countPoint>0&&buffer1.length==0){
// alert("222222222222============"+buffer1.length);
countPoint=2;
}
if(countPoint==2){
buffer2.push(str.charAt(i+1));
countPoint = 0;
}
}
// buffer2.pop();
alert("3333333333========="+buffer2.toString());
}else{
alert("sdfffdfdsafdas");
}
}
function testA(){
var ste = document.all("aa").value;
alert(ste);
testB(ste);
}
var buffer1 = new Array();
var ra = 0;
var rb = 0;
var page = 0;
var tmpLength = 0;
var counterNum = 0;
var strddd = "";
function aa(){
testA();
if(counterNum==0){
tmpLength = tmpLength;
ra = dafd;
rb = dfd;
page = dfds;
strddd = daadfadf+buffer1[counterNum];
counterNum++;
}
if(ra == ca&& rb==cb&&page==pb){
strddd = daadfadf+buffer1[counterNum];
counterNum++;
}
}
</script>
<input type="text" name="aa" value="" />
<input type="button" name="dsd" value="测试堆栈" οnclick="testA()">