87,921
社区成员
发帖
与我相关
我的任务
分享
<!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" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<title> new document </title>
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript">
(function($){
$.fn.myTest = function(options)
{
var defaults = {
d : "text"
}
var config = $.extend(defaults,options);
this.click(function()
{
alert("default : " + $(this).text());
return false;
})
}
})(jQuery);
$(function()
{
$(".test").myTest();
})
</script>
</head>
<body>
<a href="#" class="test">xxx</a> - <a href="#" class="test">yyy</a>
</body>
</html>
<!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" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<title> new document </title>
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript">
(function($){
$.fn.myTest = function(options)
{
var defaults = {
d : "text"
}
var config = $.extend(defaults,options);
this.click(function()
{
alert("default : " + config.d);
return false;
})
}
})(jQuery);
$(function()
{
$(".test").myTest({d:$(this).text()});
})
</script>
</head>
<body>
<a href="#" class="test">xxx</a> - <a href="#" class="test">yyy</a>
</body>
</html>
<!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" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<title> new document </title>
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript">
(function($){
$.fn.myTest = function(options)
{
var defaults = {
d : "text"
}
var config = $.extend(defaults,options);
this.click(function()
{
$(this).text(parseInt(Math.random()*100));
alert("default : " + config.d);
return false;
})
}
})(jQuery);
$(function()
{
$(".test").each(function()
{
$(this).myTest({d:$(this).text()});
});
})
</script>
</head>
<body>
<a href="#" class="test">50</a> - <a href="#" class="test">40</a>
</body>
</html>
<!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" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<title> new document </title>
<meta name="author" content="" />
<meta name="keywords" content="" />
<meta name="description" content="" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript">
(function($){
$.fn.myTest = function(options)
{
var defaults = {
d : "text"
}
var config = $.extend(defaults,options);
this.click(function()
{
alert("default : " + config.d);
$(this).text("hhhh");
return false;
})
}
})(jQuery);
$(function()
{
$(".test").each(function()
{
$(this).myTest({d:$(this).text()});
});
})
</script>
</head>
<body>
<a href="#" class="test">xxx</a> - <a href="#" class="test">yyy</a>
</body>
</html>