一般来说,按钮使用button标签创建,Link Button却是使用a标签创建。
效果图:
下面是Link Button按钮的演示效果:
http://www.jeasyui.com/tutorial/mb/linkbutton_demo.html
创建Link Button,只需要将一个class属性值为“easyui-lingkbutton”的样式添加到a标签中。下面我们演示如何将a标签变成按钮,首先在web目录下创建buttonDemo文件夹,在文件夹下创建buttonDemo.html。linkButtonDemo.html代码如下:
[html] view plaincopyprint?
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
- <htmlxmlns="http://www.w3.org/1999/xhtml">
- <head>
- <metahttp-equiv="Content-Type"content="text/html; charset=utf-8"/>
- <title>linkButton</title>
- <linkrel="stylesheet"type="text/css"href="themes/default/easyui.css">
- <linkrel="stylesheet"type="text/css"href="themes/icon.css">
- <scripttype="text/javascript"src="jquery-1.8.0.min.js"></script>
- <scripttype="text/javascript"src="jquery.easyui.min.js"></script>
- </head>
- <body>
- <divstyle="padding:5px;background:#fafafa;width:500px;border:1px solid #ccc">
- <a href="#"class="easyui-linkbutton"iconCls="icon-cancel">Cancel</a>
- <ahref="#"class="easyui-linkbutton"iconCls="icon-reload">Refresh</a>
- <a href="#"class="easyui-linkbutton"iconCls="icon-search">Query</a>
- <ahref="#"class="easyui-linkbutton">text button</a>
- <a href="#"class="easyui-linkbutton"iconCls="icon-print">Print</a>
- </div>
- <divstyle="padding:5px;background:#fafafa;width:500px;border:1px solid #ccc">
- <a href="#"class="easyui-linkbutton"plain="true"iconCls="icon-cancel">Cancel</a>
- <ahref="#"class="easyui-linkbutton"plain="true"iconCls="icon-reload">Refresh</a>
- <a href="#"class="easyui-linkbutton"plain="true"iconCls="icon-search">Query</a>
- <ahref="#"class="easyui-linkbutton"plain="true">text button</a>
- <a href="#"class="easyui-linkbutton"plain="true"iconCls="icon-print">Print</a>
- <ahref="#"class="easyui-linkbutton"plain="true"iconCls="icon-help"></a>
- <a href="#"class="easyui-linkbutton"plain="true"iconCls="icon-save"></a>
- <ahref="#"class="easyui-linkbutton"plain="true"iconCls="icon-back"></a>
- </div>
- </body>
-
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>linkButton</title> <link rel="stylesheet" type="text/css" href="themes/default/easyui.css"> <link rel="stylesheet" type="text/css" href="themes/icon.css"> <script type="text/javascript" src="jquery-1.8.0.min.js"></script> <script type="text/javascript" src="jquery.easyui.min.js"></script> </head> <body> <div style="padding:5px;background:#fafafa;width:500px;border:1px solid #ccc"> <a href="#" class="easyui-linkbutton" iconCls="icon-cancel">Cancel</a> <a href="#" class="easyui-linkbutton" iconCls="icon-reload">Refresh</a> <a href="#" class="easyui-linkbutton" iconCls="icon-search">Query</a> <a href="#" class="easyui-linkbutton">text button</a> <a href="#" class="easyui-linkbutton" iconCls="icon-print">Print</a> </div> <div style="padding:5px;background:#fafafa;width:500px;border:1px solid #ccc"> <a href="#" class="easyui-linkbutton" plain="true" iconCls="icon-cancel">Cancel</a> <a href="#" class="easyui-linkbutton" plain="true" iconCls="icon-reload">Refresh</a> <a href="#" class="easyui-linkbutton" plain="true" iconCls="icon-search">Query</a> <a href="#" class="easyui-linkbutton" plain="true">text button</a> <a href="#" class="easyui-linkbutton" plain="true" iconCls="icon-print">Print</a> <a href="#" class="easyui-linkbutton" plain="true" iconCls="icon-help"></a> <a href="#" class="easyui-linkbutton" plain="true" iconCls="icon-save"></a> <a href="#" class="easyui-linkbutton" plain="true" iconCls="icon-back"></a> </div> </body> </html>
注意:不要忘了将引入的文件放入buttonDemo文件夹,和前面的程序相比,引入文件新增加了:<link rel="stylesheet" type="text/css"href="themes/icon.css">。这行代码表示允许我们使用小图标。iconCls属性表示引用不同的图标。