分页: 1/3 第一页 1 2 3 下页 最后页 [ 显示模式: 摘要 | 列表 ]

js改变网页字体的大小

[不指定 2008/10/27 11:29 | by Else ]
代码:
复制代码 | 运行代码 | 另存代码
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
//Font size control
function doZoom(size) {
  document.getElementById('zoomtext').style.fontSize=size+'px';
}
</script>
</head>

<body>
<div>设置字体大小:<a href="javascript:doZoom(16);">大</a> <a href="javascript:doZoom(14);">中</a> <a href="javascript:doZoom(12);">小</a></div>
<div id="zoomtext">这个是要显示的字体大小</div>
</body>
</html>

仿口碑网菜单效果 优化了js

[不指定 2008/10/21 12:48 | by Else ]
function showmore(getid)
{
  var dshow=document.getElementById(getid);  
  var showid=dshow.getElementsByTagName("dl");
  if(showid.length<1) return false;
  for(var i=0;i    //初始化,让第一个类为over
    if(showid[i].className.indexOf("over")==-1){
      showid[0].className="over";
    }
    //遍历循环,模拟:hover伪类
    showid[i].onmouseover=function(){
      for(var j=0;j        showid[j].className="";
      }
      this.className="over";
    }
  }
  
}
window.onload=function(){
  showmore("wrapper");
  showmore("wrapper1");
  showmore("wrapper2");
  showmore("wrapper3");
}

javascript 對象的各個高度

[不指定 2008/09/03 09:40 | by Else ]
js获取浏览器高度和宽度值

引用
有xhtml的
网页可见区域宽: document.documentElement.clientWidth
网页可见区域高: document.documentElement.clientHeight
网页可见区域宽: document.documentElement.offsetWidth (包括边线的宽)
网页可见区域高: document.documentElement.offsetHeight (包括边线的高)
网页正文全文宽: document.documentElement.scrollWidth
网页正文全文高: document.documentElement.scrollHeight
网页被卷去的高: document.documentElement.scrollTop
网页被卷去的左: document.documentElement.scrollLeft
网页正文部分上: window.screenTop
网页正文部分左: window.screenLeft
屏幕分辨率的高: window.screen.height
屏幕分辨率的宽: window.screen.width
屏幕可用工作区高度: window.screen.availHeight
屏幕可用工作区宽度: window.screen.availWidth



引用

這個是html的
网页可见区域宽: document.body.clientWidth
网页可见区域高: document.body.clientHeight
网页可见区域宽: document.body.offsetWidth (包括边线的宽)
网页可见区域高: document.body.offsetHeight (包括边线的高)
网页正文全文宽: document.body.scrollWidth
网页正文全文高: document.body.scrollHeight
网页被卷去的高: document.body.scrollTop
网页被卷去的左: document.body.scrollLeft
网页正文部分上: window.screenTop
网页正文部分左: window.screenLeft
屏幕分辨率的高: window.screen.height
屏幕分辨率的宽: window.screen.width
屏幕可用工作区高度: window.screen.availHeight
屏幕可用工作区宽度: window.screen.availWidth



注意在XHTML标准下一个请将body改成documentElement
Tags:

FormValid1.0发布

[不指定 2008/08/20 10:18 | by Else ]
http://www.coderhome.net/zifa/?p=150

引用
作者:志凡
经过半年多的使用FormValid修正了一些错误及进行了部份改进,FormValid已经可以实现对表单验证的常用需求,并无严重的bug存在,FormValid已经成为快速实现表单验证的好帮手。因此今天发布了1.0的版本。

1.0主要改进

disabled的元件不进行验证
比较大小判断的改正
增加了isTelephone决断,即电话验证可包括手机和市话
url规则支持https

增加了元件onblur即时提示错误信息的插件.FV_onBlur.js


本站下载
下载

DEMO

jquery

[不指定 2008/07/08 17:50 | by Else ]
一个忽悠的效果
<script src="js/jquery.js"></script>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script>
$(document).ready(function(){
  $("#abc").animate({opacity: 'show'  },'slow',
            function()
            {
              // alert("ok");
              $(this).css("border","0px solid #0033CC")
              $(this).fadeTo("slow", 0.1);
              $("#efg").fadeTo("fast", 1);
              $(this).fadeTo("slow", 1);
              $(this).css("border","1px solid #0033CC");
                
            });

  
  //$("#abc").hide("slow");
});
</script>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script>
document.write(escape("哈哈")+"<br>");//原来用这个加密测试
document.write(unescape("%u54C8%u54C8")+"<br>");//
document.write(encodeURIComponent("哈哈")+"<br>");
document.write(decodeURIComponent("%E5%93%88%E5%93%88")+"<br>");

</script>
</head>

<body>
<?php
echo urldecode("%E5%93%88%E5%93%88");
echo "<br>";
echo rawurldecode("%E5%93%88%E5%93%88");
echo "<br />";
echo utf8_decode("%E5%93%88%E5%93%88");
echo "<br />";
echo "%E5%93%88%E5%93%88";
echo "<br />";
echo $_GET['act'];
echo "<br />";
echo urlencode($_GET['act']);
?>
</body>
</html>
Tags: , ,

jquery的提交評論!

[不指定 2008/01/23 11:18 | by Else ]
function updatecom()
{
  //提交评论
  $("#msg").addClass("msg");
  
  $.ajax({
    beforeSend:function(){$("#msg").html("正在发送数据");},
    type: "POST",
    //timeout:2000,
    url: "xhttp.php",
    data:$("input[@type=text]").serialize()+"&content="+$("#content").val()+"&rubyid="+$("#rubyid").val()+"&readycom="+$("#readycom"),
    success: function(getstr){
    changeimg();
    if(getstr=="code_error"){
      $("#msg").html("验证码错了");
    }else if(getstr=="cnull"){
      $("#msg").html("评论的内容为空");
    }else{
      $("#msg").html("你的评论提交成功,刷新后显示");
      $("#recom").append("<div class =cls7>您添加的评论:<br />"+$("#content").text().replace("<","&lt;")+"</div>");
      document.getElementById("comments").reset();
    }
    },
    error:function(){("#msg").html("发生错误");}
    
  })
    
}

</script>

自动提交表单

[不指定 2008/01/09 15:16 | by Else ]
js自动提交表单
   <script language="Javascript" >
     document.form.submit();    
   </script>
Tags:

顯示的js

[不指定 2007/12/10 15:10 | by Else ]
js版
<script language="javascript" type="text/javascript">
function show(id){
  try{
    var n = id;
    for(i=1;i<6;i++)
  {
        document.getElementById('shop'+i).style.display='none';
     }
  
  
    document.getElementById('shop'+n).style.display='block';
    
  }catch(e){}
}
</script>

jq版

function showdNews(n,oobj)
{
show=oobj+n;  
for(i=1;i<5;i++){
$('#'+oobj+i).hide();  
}  
$('#'+show).show();
}
Tags: ,

jquery的data处理

[不指定 2007/11/12 00:08 | by Else ]
  data="pid="+$("#pid").val();
  
  if($("#catname").val()!=""){
    data+="&catname="+$("#catname").val();
  }else{
      $("#catname_v").html("分类名一定要写");
      return false;
  }if($("#cathtmlname").val()!=""){
    data+="&cathtmlname="+$("#cathtmlname").val();
  }else{
      $("#cathtmlname_v").html("英文目录要写用英文");
      return false;
  }if($("#catlist").val()!=""){
    data+="&catlist="+$("#catlist").val();
  }else{
      $("#catlist_v").html("顺序要写");
      return false;
  }
分页: 1/3 第一页 1 2 3 下页 最后页 [ 显示模式: 摘要 | 列表 ]