要求:动态输入内容,点击post生成内容条,实现自动翻页!
废话不多说,直接上代码:
js代码:
var date=new Date();
var myDate=date.getDate()+"/"+(date.getMonth()+1)+"/"+date.getFullYear();
var arr=new Array();
var pagesize=8;
var curpage=0;
var id=0;
var ind=0;
function getContent(){
var getMind=document.getElementById("mindBox").value.replace(/(^\s*)|(\s*$)/g,"");
var getMoods=document.getElementsByName("Answer");
var flag=false;
var getMood=""
for(var i=0; i<getMoods.length; i++)
{
if(getMoods[i].checked){
flag=true;
ind=i;
}
}
if(ind==0){getMood="1.png"}else if(ind==1){getMood="2.png"}else if(ind==2){getMood="3.png"}
if(getMind==""){alert("Please write your mind !"); return false;}
else if(!flag){alert("Please choose your mood !"); return false;}
arr[arr.length]=[myDate,getMood,getMind,id];//将获取的数据放入多维数组中
id++;
}
function checkTable(){
var arry_return = new Array();
var start_t;
var end_t;
var start=curpage*pagesize;
if(pagesize+start<arr.length){
start_t = start;
end_t