函数链式操作

链式操作就是分步骤地对对象实现各种操作;
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

</body>
</html>
<script>
    function show(str)
    {
        alert(str);
        return show;
    }
    //var a = show("2233");
    //a("abc");
    show('abc')('bcd')(13)(444)('bdsf')(3123);
</script>

方法show会依次执行下面传入的参数。

例如:

$(function (){
    $('input').hover(function (){
        document.title='over';
    }, function (){
        document.title='out';
    }).css({ '200px', height: '100px', background: 'green'}).click(function (){
        alert('a');
    });
});
原文地址:https://www.cnblogs.com/wang715100018066/p/6323388.html