存档

文章标签 ‘Javascript’

几个有用的jQuery资源站点

2010年5月11日 没有评论
分类: 随笔 标签: ,

Roar

2009年12月30日 没有评论
No Gravatar

Roar is a notification widget that streamlines incoming messages, such as updates or errors, without distracting the user from their browser experience or breaking their work-flow by displaying obtrusive alerts. Roar is inspired by Growl, the notification system for Mac OS X and is realised with MooTools.

Roar是一个消息通知工具。不过本来想找的是能够闪动窗体标题的JavaScript代码。

JS滚动实例

2009年11月2日 没有评论
No Gravatar

下述代码可以实现内容左右循环滚动。关键,xq_1中的内容要大于xq的宽度。另外,xq_1这个td要指定nowrap,否则在Firefox和Chrome中不会滚动的,因为内容折行了。


<div id="xq" style="overflow:hidden;height:12px;width:899px;">
            <table width="99%" border="0" cellspacing="0" cellpadding="0" align="center">
              <tr>
                <td id="xq_1" nowrap="nowrap">
		</td>
                <td id="xq_2" valign="top" nowrap="nowrap"></td>
        </tr>
            </table>
          </div>
            <script>
var xq_speed=25
xq_2.innerHTML=xq_1.innerHTML
function xq_Marquee1(){
if(xq_2.offsetWidth-xq.scrollLeft< =0)
xq.scrollLeft-=xq_1.offsetWidth
else{
xq.scrollLeft++
}
}
var xq_MyMar=setInterval(xq_Marquee1,xq_speed)
xq.onmouseover=function() {clearInterval(xq_MyMar)}
xq.onmouseout=function() {xq_MyMar=setInterval(xq_Marquee1,xq_speed)}
        </script>

jQuery也很方便啊

2009年10月27日 没有评论
No Gravatar

原来有段javascript的代码,是滚动图片的。因为最近在看jQuery,就用jQuery改造一下,下面这段勉强可用。等偶慢慢搞成好点的版本,再整理个例子:


jQuery.fn.horzScroller = function(params) {
        var p = params || {
                container: "",
                scroller: "",
                ref: "",
                speed: 25,
                dir: true
        };

        var _container = $("#" + p.container);
        var _scroller  = $("#" + p.scroller);
        var _ref       = $("#" + p.ref);
        var _speed     = p.speed;
        var _marquee;
        var _dir       = p.dir;

        var scrollLeft = function() {
                if(_container.width() - _container.scrollLeft() < =0)
                        _container.scrollLeft(0);
                else
                        _container.scrollLeft(_container.scrollLeft() + 1);
        };

        var scrollRight = function() {
                if(_ref.offsetWidth() - _container.scrollLeft() <=0)
                        _container.scrollLeft(_container.scrollLeft() - _scroller.offsetWidth());
                else
                        _container.scrollLeft(_container.scrollLeft() + 1);
        };

        var init = function() {
                _ref.html(_scroller.html());

                if (_dir)
                        _marquee = setInterval(scrollLeft, _speed);
                else
                        _marquee = setInterval(scrollRight, _speed);
                _container.mouseover(function(e) {
                                        clearInterval(_marquee);
                                }
                );
                _container.mouseout(function(e) {
                                if (_dir)
                                        _marquee = setInterval(scrollLeft, _speed);
                                else
                                        _marquee = setInterval(scrollRight, _speed);
                                }
                );
        }
        init();
}

调用界面:


< !DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
                    "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" src="js/jquery-1.3.2.js"></script>
<script type="text/javascript" src="js/fbi.horzScroller.js"></script>

  <script>
  $(document).ready(function(){
				$("#xy").horzScroller({
					container: "scroll",
					scroller: "scroll",
					ref: "scroll",
					speed: 25,
					dir: true
				});

  });
  </script>
  <style>
div.demo {
background:#CCCCCC none repeat scroll 0 0;
border:3px solid #666666;
margin:5px;
padding:5px;
position:relative;
width:200px;
height:100px;
overflow:hidden;
}
  p { margin:10px;padding:5px;border:2px solid #666;width:1000px;}
  </style>
</head>
<body>
  <div id="scroll" class="demo"><p>Hello,10000000000000000000000000000000000000000000000000</p></div>
</body>
</html>

**注意,在滚动的区域的内内容要宽度大于外面的容器才可以。

关于此实例的完整代码和说明稍后再推出吧。正事儿要紧。

参考:
http://www.cnblogs.com/andylaufzf/archive/2009/03/26/1422255.html
http://www.cnblogs.com/terrylee/archive/2007/12/09/the-ultimate-jquery-plugin-list.html

http://jqueryui.com/
http://www.corrie.net.cn/e/321.htm
http://www.skiyo.cn/article/Skiyo-74-1228116085.html

分类: Coding, 技巧, 技术 标签: ,

javascript获取客户端网卡MAC地址和IP地址和计算机名

2009年7月19日 没有评论
No Gravatar

在做 B/S 结构的系统时,我们常常需要获取客户端的一些信息,如 IP MAC ,以结合身份验证。 要获取服务器端的 MAC 很容易,但是要获取客户端的 MAC 的地址确要花费一翻心思,通常的做法是调用 Win32API 或直接调用nbtstat 命令,这样做有很多问题,而另一种方法就是直接用客户端脚本,我们这里用 Javascript ,这样做的好处是不需要服务器端进行处理,有客户端自行获取,传递到服务器端,且速度和可靠性都比在服务器端获取好。
具体实现的html和javascript如下:

http://zhupan.javaeye.com/blog/26440

此法仅限于IE,可见IE着实“安全”,“安全”呐。

分类: Coding, 技巧, 技术 标签: , , ,

Switch to our mobile site