欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

在layui.use 中自定義 function 的正確方法

 更新時間:2019年09月16日 08:40:02   作者:肖朋偉  
今天小編就為大家分享一篇在layui.use 中自定義 function 的正確方法,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧

適用于:

obj.click()

行內(nèi) onclick

javascript:函數(shù)名()

示例代碼:

<html>
 <head>
 <link rel="stylesheet" href="layui/css/layui.css" rel="external nofollow" media="all">
 </head>
 <body>
 <a class="layui-btn" id="test" href="javascript:;" rel="external nofollow" rel="external nofollow" >測試</a><br/><br/>
 <a class="layui-btn" onclick="hello('this is a test')" href="javascript:;" rel="external nofollow" rel="external nofollow" >hello</a>
 <script src="layui/layui.js"></script>
 <script type="text/javascript">
 
 layui.use(["jquery","layer","form"],function(){
 var $ = layui.$,layer = layui.layer,form = layui.form;
 $("#test").click(function(){
  hello("張三");
 });
 window.hello = function(obj) {
  layer.msg("hello world,"+obj);
 }
 });
 </script> 
 </body>
</html>

測試:

(1)點擊測試按鈕

(2)點擊 hello 按鈕

以上這篇在layui.use 中自定義 function 的正確方法就是小編分享給大家的全部內(nèi)容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關(guān)文章

最新評論