您正在查看 "web前端" 分类下的文章 2010-08-30 14:55 参见下图:
(完) |
2010-08-30 14:45 HTML5很强大,直接一句话HTML,如下:
<input type=search results=5 name=s placeholder=例如:美女 />
结果在Safari或是Chrome浏览器下:

您可以狠狠地点击这里: webkit下的搜索框demo
其中使用::-webkit-in |
2010-07-13 17:43 效果如下:

js代码如下:
<body>
<script type="text/javascript">
var h = "";
for(var i=0; i<100; i++){
var c = i;
if(i<10){
c = "0"+i;
}
c = "#ff00" + c;
h += '<div style="width:500px; height:1px; overf |
2010-07-12 14:21 代码如下:
获取滚动条到顶部的垂直高度
$(document).scrollTop();
获取滚动条到左边的垂直宽度
$(document).scrollLeft();
(完) |
2010-07-11 0:44 <script type="text/javascript">
$(document).ready(function()
{
alert($(window).height()); //浏览器当前窗口可视区域高度
alert($(document).height()); //浏览器当前窗口文档的高度
alert($(document.body).height());//浏览器当前窗口文档body的高度
alert($(document.body).outerHeight(true));//浏览器当前窗口文档body的总高度 包括border padding margin
alert($(window).width()); //浏览器当前窗口可视区域宽度
alert($(document).width());//浏览器当前窗口 |
2010-07-08 11:49 如下:
<html> <head> <script type=”text/javascript”> var start = (new Date).getTime(); </script> </head> <body> <script type=”text/javascript”> /* do work here */ var pageLoad = (new Date).getTime() - start; </script> </body> </html>
(完) |
2010-06-10 10:20 测试代码如下:
<img id="img" src="http://image.zhangxinxu.com/image/study/s/s256/mm1.jpg" style="width:200px;" />
<button id="btn">宽度</button>
<script type="text/javascript">
document.getElementById("btn").onclick = function(){
alert(document.getElementById("img").width);
};
</script>
|
2010-05-07 19:20 写法如下:
var sh = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0;
(完) |
2010-04-29 9:55 关键代码如下:
var today=new Date();
today.setTime(today.setDate(today.getDate()+1));
纯属备忘。 |
2010-04-19 18:20 测试代码如下:
<script type="text/javascript">
$(function(){
$("#foo").bind({
click: function(){
$("#show").text("你居然点人家!");
},
mouseover: function(){
$("#show").text("哎呦,你摸人家~~");
},
mouseout: function(){
$("#show").text(" |
2010-04-19 18:16 代码如下:
$(function(){
$("<div/>",{
id: "justTest",
className: "red",
css: {
width: "200px",
height: "40px",
backgroundColor: "#f0f3f9"
},
click: function(){
alert("别点我,真是疼!");
},
t |
2010-01-30 2:40 如何实现静态页面的页面跳转重定向效果?
简单,在head头部加入这样一句话,
<meta http-equiv="refresh" content="1;url=http://www.zhangxinxu.com/">
就可以了。 |
2010-01-17 21:51 使用jQuery编写。试验版,效率还有待改进,webkit核心浏览器下还有小小问题。
如下:

JavaScript代码处理后,就变成:

这里的实现的 |
2009-12-18 22:54 下为jQuery下的方法。
$.htmlText = function(str){
return str.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");
};
demo页面
效果:
|
2009-12-16 1:52 验证数字和*号。
下为测试代码:
<body>
<input type="text" id="txt" />
<input type="button" value="确定" id="btn" />
<div id="show"></div>
<script type="text/javascript">
document.getElementById("btn").onclick = function(){
var tel = document.getElementById("txt").value;
var l = tel.length;
|
| | |