js修改表格样式Word格式文档下载.docx

上传人:b****4 文档编号:6662979 上传时间:2023-05-07 格式:DOCX 页数:13 大小:18.02KB
下载 相关 举报
js修改表格样式Word格式文档下载.docx_第1页
第1页 / 共13页
js修改表格样式Word格式文档下载.docx_第2页
第2页 / 共13页
js修改表格样式Word格式文档下载.docx_第3页
第3页 / 共13页
js修改表格样式Word格式文档下载.docx_第4页
第4页 / 共13页
js修改表格样式Word格式文档下载.docx_第5页
第5页 / 共13页
js修改表格样式Word格式文档下载.docx_第6页
第6页 / 共13页
js修改表格样式Word格式文档下载.docx_第7页
第7页 / 共13页
js修改表格样式Word格式文档下载.docx_第8页
第8页 / 共13页
js修改表格样式Word格式文档下载.docx_第9页
第9页 / 共13页
js修改表格样式Word格式文档下载.docx_第10页
第10页 / 共13页
js修改表格样式Word格式文档下载.docx_第11页
第11页 / 共13页
js修改表格样式Word格式文档下载.docx_第12页
第12页 / 共13页
js修改表格样式Word格式文档下载.docx_第13页
第13页 / 共13页
亲,该文档总共13页,全部预览完了,如果喜欢就下载吧!
下载资源
资源描述

js修改表格样式Word格式文档下载.docx

《js修改表格样式Word格式文档下载.docx》由会员分享,可在线阅读,更多相关《js修改表格样式Word格式文档下载.docx(13页珍藏版)》请在冰点文库上搜索。

js修改表格样式Word格式文档下载.docx

680px;

  #content{margin:

  table,td{

  font:

88%arial,helvetica,sans-serif;

  }

  table{width:

100%;

border-collapse:

collapse;

1em0;

  th,td{text-align:

center;

0.5em;

border:

1pxsolid#fff;

  th{background:

#328aa4url(tr_back.gif)repeat-x;

#fff;

  td{background:

#e5f1f4;

  /*tableclothstyles*/

  tr.eventd{background:

  tr.oddtd{background:

#f8fbfc;

  th.over,tr.eventh.over,tr.oddth.over{background:

#4a98af;

  th.down,tr.eventh.down,tr.oddth.down{background:

#bce774;

  th.selected,tr.eventh.selected,tr.oddth.selected{}

  td.over,tr.eventd.over,tr.oddtd.over{background:

#ecfbd4;

  td.down,tr.eventd.down,tr.oddtd.down{background:

  td.selected,tr.eventd.selected,tr.oddtd.selected{background:

  /*usethisifyouwanttoapplydifferentstyleingtoemptytablecells*/

  td.empty,tr.oddtd.empty,tr.eventd.empty{background:

  this.tablecloth=function(){

  //conFig

  //ifsettotruethenmouseoveratablecellwillhighlightentirecolumn(exceptsiblingheadings)

  varhighlightcols=true;

  //ifsettotruethenmouseoveratablecellwillhighlightentirerow(exceptsiblingheadings)

  varhighlightRows=true;

  //ifsettotruethenclickonatablesellwillselectroworcolumnbasedonconfigvarselectable=true;

  //thisfunctioniscalledwhen

  //addyourowncodeifyouwanttoaddaction

  //functionreceivesobjectthathasbeenclicked

  this.clickaction=function(obj){

  //alert(obj.innerhtml);

  };

  //endconFig(donoteditbelowthisline)

  vartableover=false;

  this.start=function(){

  vartables=document.getelementsbytagname("

table"

);

  for(vari=0;

i  tables[i].onmouseover=function(){tableover=true};

  tables[i].onmouseout=function(){tableover=false};

  rows(tables[i]);

  this.rows=function(table){

  varcss="

"

;

  vartr=table.getelementsbytagname("

tr"

i  css=(css=="

odd"

)"

even"

:

  tr[i].classname=css;

  vararr=newarray();

  for(varj=0;

j  if(tr[i].childnodes[j].nodetype==1)arr.push(tr[i].childnodes[j]);

j  arr[j].row=i;

  arr[j].col=j;

  if(arr[j].innerhtml=="

||arr[j].innerhtml=="

)arr[j].classname+="

empty"

  arr[j].css=arr[j].classname;

  arr[j].onmouseover=function(){

  over(table,this,this.row,this.col);

  arr[j].onmouseout=function(){

  out(table,this,this.row,this.col);

  arr[j].onmousedown=function(){

  down(table,this,this.row,this.col);

  arr[j].onmouseup=function(){up(table,this,this.row,this.col);

};

arr[j].onclick=function(){click(table,this,this.row,this.col);

//appylingmouseoverstateforobjects(thortd)this.over=function(table,obj,row,col){if(!

highlightcolsif(check1(obj,col)){if(highlightcols)highlightcol(table,obj,col);

if(highlightRows)highlightRow(table,obj,row);

//appylingmouseoutstateforobjects(thortd)this.out=function(table,obj,row,col){if(!

highlightcolsunhighlightcol(table,col);

unhighlightRow(table,row);

//appylingmousedownstateforobjects(thortd)this.down=function(table,obj,row,col){obj.classname=obj.css+"

down"

//appylingmouseupstateforobjects(thortd)this.up=function(table,obj,row,col){obj.classname=obj.css+"

over"

//onclickeventforobjects(thortd)this.click=function(table,obj,row,col){if(check1){if(selectable){unselect(table);

if(highlightcols)highlightcol(table,obj,col,true);

if(highlightRows)highlightRow(table,obj,row,true);

document.onclick=unselectall;

}};

clickaction(obj);

  this.highlightcol=function(table,active,col,sel){varcss=(typeof(sel)!

="

undefined"

selected"

vartr=table.getelementsbytagname("

for(vari=0;

i  for(vari=0;

i  for(varj=0;

j  varobj=tr[i].childnodes[j];

  if(obj.classname)obj.classname=obj.classname.replace("

"

  this.unselectall=function(){

  if(!

tableover){

  tables=document.getelementsbytagname("

i  unselect(tables[i])

  this.check1=function(obj,col){

  return(!

(col==0

  this.check2=function(active,obj){

(active.tagname=="

th"

  this.check3=function(obj){

  return(obj.classname)(obj.classname.indexof("

)==-1):

true;

  start();

  /*scriptinitiatesonpageload.*/

  window.onload=tablecloth;

  tablecloth:

example

  title

  篇二:

js验证表单大全+css样式

  js验证表单大全

  1.长度限制

  functiontest()

  {

  if(document.a.b.value.length>

50)

  alert("

不能超过50个字符!

  document.a.b.focus();

  returnfalse;

  2.只能是汉字

  3."

只能是英文

  functiononlyeng()

(event.keycode>

=65

  4.只能是数字

  functiononlynum()

((event.keycode>

=48

  5.只能是英文字符和数字

onbeforepaste="

clipboarddata.setdata(text,clipboarddata.getdata(text).replace(/[^\d]/g,))"

  6.验证油箱格式

  functionisemail(stremail){

  if  

  (stremail.search(/^\w+((-\w+)|(\.\w+))*\@[a-za-z0-9]+((\.|-)[a-za-z0-9]+)*\.[a-za-z0-9]+$/)!

=-1)

  returntrue;

  else

oh"

  7.屏蔽关键字(这里屏蔽***和****)

  functiontest(){

  if((a.b.value.indexof("

***"

)==0)||(a.b.value.indexof("

****"

)==0)){

  a.b.focus();

  8.两次输入密码是否相同

  functioncheck()

  with(document.all){

  if(input1.value!

=input2.value)

false"

  input1.value="

  input2.value="

  elsedocument.forms[0].submit();

  够了吧:

  屏蔽右键很酷

  oncontextmenu="

returnfalse"

ondragstart="

onselectstart="

加在body中

  二

  2.1表单项不能为空

    functioncheckForm()

  if(document.form.name.value.length==0){

请输入您姓名!

  document.form.name.focus();

  -->

  2.2比较两个表单项的值是否相同

  if(document.form.pwd.value!

=document.form.pwd_again.value){alert("

您两次输入的密码不一样!

请重新输入."

  document.adduser.pwd.focus();

  2.3表单项只能为数字和"

_"

用于电话/银行帐号验证上,可扩展到域名注册等

    functionisnumber(string)

  varletters="

1234567890-"

//可以自己增加可输入值

  vari;

  varc;

  if(string.charat(0)==-)

  if(string.charat(string.length-1)==-)

  for(i=0;

i  {

  c=string.charat(i);

  if(letters.indexof(c)  returnfalse;

  functioncheckForm()

isnumber(document.form.tel.value)){

您的电话号码不合法!

  document.form.tel.focus();

  2.4表单项输入数值/长度限定

  if(document.form.count.value>

100||document.form.count.value{

输入数值不能小于零大于100!

  document.form.count.focus();

  if(document.form.message.value.length  {

输入文字小于10!

  document.form.message.focus();

  }  returntrue;

  //-->

  2.5中文/英文/数字/邮件地址合法性判断  functionisenglish(name)//英文值检测{

  if(name.length==0)

i128)

  functionischinese(name)//中文值检测{

  functionismail(name)//e-mail值检测{

isenglish(name))

  i=name.indexof("

at"

  j=namedotlastindexof("

if(i==-1)

  if(i!

=j)

  if(i==namedotlength)

  篇三:

js分页、表格、生成数据

  js分页、表格、生成数据

  使用js控制分页

  参考博客园的样式,效果如下:

  使用js

  创建表格

  //js表格生成表格代码

  //arrth表头信息

  //arrtr数据

  vargettable=function(arrth,arrtr){

  vars=;

  s+=;

i  s+=+arrth[i]+;

i  s+=;

j  s+=+arrtr[i][j]+;

  returns;

  js分页

  //js分页

  //el:

分页容器count:

总记录数pagestep:

每页显示多少个pagenum:

第几页fngo:

分页跳转函数

  varjspage=function(el,count,pagestep,pagenum,fngo){this.getlink=function(fngo,index,pagenum,text){

  vars=  if(index==pagenum){

  s+=class="

acur"

  text=text||index;

  s+=>

+text+;

  //总页数

  varpagenumall=math.ceil(count/pagestep);

  if(pagenumall==1){

  divpage.innerhtml=;

  return;

  varitemnum=5;

//当前页左右两边显示个数

  pagenum=math.max(pagenum,1);

  pagenum=math.min(pagenum,pagenumall);

  if(pagenum>

1){

  s+=this.getlink(fngo,pagenum-1,pagenum,上一页);

}else{

  s+=上一页;

  varbegin=1;

  if(pagenum-itemnum>

  s+=this.getlink(fngo,1,pagenum)+...;

begin=pagenum-itemnum;

  varend=math.min(pagenumall,begin+itemnum*2);

  if(end==pagenumall-1){

  end=pagenumall;

  for(vari=begin;

i  s+=this.getlink(fngo,i,pagenum);

  if(end    s+=...+this.getlink(fngo,pagenumall,pagenum);

  if(pagenum    s+=this.getlink(fngo,pagenum+1,pagenum,下一页);

  s+=下一页;

  }var

  divpage=document.getelementbyid(el);

  divpage.innerhtml=s;

  js返回随机数据

  //js随机内容

  varjsRand={};

  //随机数字

  jsRand.int=function(min,max){

  returnthis.show(i,min,max);

  //随机字符

  jsRand.str=jsRand.string=function(min,max){

  returnthis.show(,min,max);

  //随机日期

  jsRand.date=function(){

  returnthis.show(d);

  //随机金额

  jsRand.money=function(min,max){

  returnthis.show(m,min,max);

  //随机汉字

  jsRand.ch=function(min,max){

  returnthis.show(ch,min,max);

  jsRand.show=function(type,min,max){

  varstr;

  if(type==i){

  str=this.rand(min,max);

  }elseif(type==m){

  str=¥+this.rand(min,max)+.00;

  }elseif(type==d){

  str=this.rand(1990,2020)+-;

  str+=this.rand(1,12,2)+-;

  str+=this.rand(1,31,2)+;

  str+=this.rand(0,23,2)+:

  str+=this.rand(1,59,2);

  }else{

  min=min||0;

  max=max||10;

  str=;

  varlen=this.rand(min,ma

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 自然科学 > 物理

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2