jquery中的几个注意问题
2017-12-26 09:48
183 查看
1 jquery中引用文件,需要引用4个文件。2个css和2个js。但2个js的顺序不能颠倒。不然会报错。正确的顺序如下:
如:<link rel="stylesheet" type="text/css" href="./common/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="./common/easyui/themes/icon.css">
<script type="text/javascript" language="javascript" src="./common/easyui/jquery-1.7.2.min.js"></script>
<script type="text/javascript" language="javascript" src="./common/easyui/jquery.easyui.min.js"></script>
jquery-1.7.2.js必须在jquery.easyui.min.js的前面。不然会报错。
2 引用css文件时。必须添加rel属性和type属性。不然会导致不能正确的显示样式。
如:<link rel="stylesheet" type="text/css" href="./common/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="./common/easyui/themes/icon.css">
3 应用css文件时。link标签不用结尾标签。而引用js文件时。script标签必须有结尾标签</script>不然会导致错误。切记。
如:<link rel="stylesheet" type="text/css" href="./common/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="./common/easyui/themes/icon.css">
<script type="text/javascript" language="javascript" src="./common/easyui/jquery-1.7.2.min.js"></script>
<script type="text/javascript" language="javascript" src="./common/easyui/jquery.easyui.min.js"></script>
4 在jsp界面使用jquery的默认处理函数。类似于jquery的load函数。$(function(){...})
如:$(function(){
$("#combobox1").combobox({
width:100,
//height:10,
panelHeight:"auto",
valueField:"id",
textField:"text",
url:"./json/combobox_json.json"
});
5 使用combobox时。可以使用input标签,也可以使用select标签。都可以。
如:<input type="text" id="combobox1" name="combobox1" value=""/>
<br/><br/>
<select id="select1" name="select1">
-------------js-------
$(function(){
$("#combobox1").combobox({
width:100,
//height:10,
panelHeight:"auto",
valueField:"id",
textField:"text",
url:"./json/combobox_json.json"
});
$("#select1").combobox({
width:100,
//height:100,
panelHeight:"auto",
valueField:"id",
textField:"text",
url:"./json/combobox_json.json"
});
})
6 combobox的属性中没有height属性。使用也无效。
如:$("#combobox1").combobox({
width:100,
//height:10,
panelHeight:"auto",
valueField:"id",
textField:"text",
url:"./json/combobox_json.json"
});
7 combobox属性中有valueField属性和textField属性。这是下拉框的值和显示值。
如:$("#combobox1").combobox({
width:100,
//height:10,
panelHeight:"auto",
valueField:"id",
textField:"text",
url:"./json/combobox_json.json"
});
8 combobox属性中有url属性。该属性可以通过文件来为下拉框赋值。是json文件
如:$("#combobox1").combobox({
width:100,
//height:10,
panelHeight:"auto",
valueField:"id",
textField:"text",
url:"./json/combobox_json.json"
});
9 combobox中可以通过json文件为下拉框赋值。但是json文件中必须是双引号"符号。而不能是单引号'符号。必须使用双引号才能正确的显示。切记必须使用双引号。为了以后保证正确。统统使用双引号。
如:[{
"id":"123",
"text":"text7"
},
{
"id":"234",
"text":"test8"
}]
10 combobox可以通过json文件赋值。但是json文件的格式是类似于jsonArray格式的。
如:[{
"id":"123",
"text":"text7"
},
{
"id":"234",
"text":"test8"
}]
以上几点是基本的。但也是很重要的。切记。
如:<link rel="stylesheet" type="text/css" href="./common/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="./common/easyui/themes/icon.css">
<script type="text/javascript" language="javascript" src="./common/easyui/jquery-1.7.2.min.js"></script>
<script type="text/javascript" language="javascript" src="./common/easyui/jquery.easyui.min.js"></script>
jquery-1.7.2.js必须在jquery.easyui.min.js的前面。不然会报错。
2 引用css文件时。必须添加rel属性和type属性。不然会导致不能正确的显示样式。
如:<link rel="stylesheet" type="text/css" href="./common/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="./common/easyui/themes/icon.css">
3 应用css文件时。link标签不用结尾标签。而引用js文件时。script标签必须有结尾标签</script>不然会导致错误。切记。
如:<link rel="stylesheet" type="text/css" href="./common/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="./common/easyui/themes/icon.css">
<script type="text/javascript" language="javascript" src="./common/easyui/jquery-1.7.2.min.js"></script>
<script type="text/javascript" language="javascript" src="./common/easyui/jquery.easyui.min.js"></script>
4 在jsp界面使用jquery的默认处理函数。类似于jquery的load函数。$(function(){...})
如:$(function(){
$("#combobox1").combobox({
width:100,
//height:10,
panelHeight:"auto",
valueField:"id",
textField:"text",
url:"./json/combobox_json.json"
});
5 使用combobox时。可以使用input标签,也可以使用select标签。都可以。
如:<input type="text" id="combobox1" name="combobox1" value=""/>
<br/><br/>
<select id="select1" name="select1">
-------------js-------
$(function(){
$("#combobox1").combobox({
width:100,
//height:10,
panelHeight:"auto",
valueField:"id",
textField:"text",
url:"./json/combobox_json.json"
});
$("#select1").combobox({
width:100,
//height:100,
panelHeight:"auto",
valueField:"id",
textField:"text",
url:"./json/combobox_json.json"
});
})
6 combobox的属性中没有height属性。使用也无效。
如:$("#combobox1").combobox({
width:100,
//height:10,
panelHeight:"auto",
valueField:"id",
textField:"text",
url:"./json/combobox_json.json"
});
7 combobox属性中有valueField属性和textField属性。这是下拉框的值和显示值。
如:$("#combobox1").combobox({
width:100,
//height:10,
panelHeight:"auto",
valueField:"id",
textField:"text",
url:"./json/combobox_json.json"
});
8 combobox属性中有url属性。该属性可以通过文件来为下拉框赋值。是json文件
如:$("#combobox1").combobox({
width:100,
//height:10,
panelHeight:"auto",
valueField:"id",
textField:"text",
url:"./json/combobox_json.json"
});
9 combobox中可以通过json文件为下拉框赋值。但是json文件中必须是双引号"符号。而不能是单引号'符号。必须使用双引号才能正确的显示。切记必须使用双引号。为了以后保证正确。统统使用双引号。
如:[{
"id":"123",
"text":"text7"
},
{
"id":"234",
"text":"test8"
}]
10 combobox可以通过json文件赋值。但是json文件的格式是类似于jsonArray格式的。
如:[{
"id":"123",
"text":"text7"
},
{
"id":"234",
"text":"test8"
}]
以上几点是基本的。但也是很重要的。切记。
相关文章推荐
- 网络爬虫设计中需要注意的几个问题
- 应聘时注意的几个问题,收着有用
- 使用GDI+时需要注意的几个问题
- Net1.x转换为.Net2.0要注意的几个问题
- 在jquery的ajax方法中的success中使用return要注意的问题
- PHP Header用于页面跳转要注意的几个问题总结
- (vs2005)使用Log4Net要注意的几个问题。
- jquery在IE中使用append应注意的问题
- 选购美国虚拟主机需要注意的几个问题
- jsp引入struts标签,引入自己写的jquery需要注意的问题
- java Web项目布署到TomCat的几个注意问题
- 使用phantomjs操作DOM并对页面进行截图需要注意的几个问题
- C#调用Delphi DLL时,要注意的几个问题。
- jQuery调用WCF需要注意的一些问题
- 关于招行信用卡还款日期的几个注意问题
- 使用Visual Basic访问数据库几个注意的问题
- 开发:随笔记录之 OSGI的jar添加几个小问题及其注意的地方
- 搭建SSH框架是应注意的几个问题
- jQuery中需要注意的细节问题小结
- jQuery调用WCF需要注意的一些问题