参考一下的文章即可:
https://www.cnblogs.com/karthuslorin/p/9038854.html
http://www.php.cn/js-tutorial-399072.html