--------------------------------------------------------------------------------------------------
ajax语法和通过for遍历List等集合
$.ajax(
{
type:
"post"
,
url:
"../newvillage/getCityInfo.do"
,
data:
null
,
dataType:
"json"
,
success:
function
(data)
{
for
(
var
i
in
data)
{
$(
"#proSelect"
).append(
"<optionvalue='"
+data[i].proId+
"'>"
+data[i].proName+
" </option>"
);
}
}
}
);
jquery获取select的值
var
selectVal= $(
"#MobileChannel"
).val();
jquery通过select的name属性得到当前select的值
function
queryselectval()
{
var
selectVal= $(
"select[name='status']"
).val();
return
selectVal;
}
--------------------------------------------------------------------------------------------------
jquery弹出对话框
![](https://app.yinxiang.com/shard/s33/res/0c318a4d-71c5-4bbb-8522-0068490a2dcd.png)
代码:
if
(confirm(
"是否导出Excel"
))
{
}else{
}
--------------------------------------------------------------------------------------------------
![](https://app.yinxiang.com/shard/s33/res/cf580c8e-7eff-4228-9393-a9019bfffc1d.png)
代码:
function
status1(obj)
{
var
str=prompt(
"请填写失败原因,将会以短信形式发送给用户"
,
"请填写审核失败的原因"
);
if
(str)
{
$.ajax(
{
type:
"post"
,
url:
"../angent/ajaxupdateAgentCardInfoDescNo.do"
,
data:
{
"agentId"
:obj,
"message"
:str
}
,
dataType:
"json"
,
success:
function
(data)
{
location.href=data;
}
}
);
}
}
--------------------------------------------------------------------------------------------------
控制手机浏览器不能缩放网页:
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
--------------------------------------------------------------------------------------------------
绑定下拉框的值
$(
function
()
{
<#
if
flag??>
<#
if
flag==3>
$(
"#o3"
).attr(
"selected"
,
"selected"
);
</#
if
>
<#
if
flag==1>
$(
"#o1"
).attr(
"selected"
,
"selected"
);
</#
if
>
<#
if
flag==0>
$(
"#o0"
).attr(
"selected"
,
"selected"
);
</#
if
>
</#
if
>
}
);
获得radio的选中的值
$('input[nam
e="adId"]:c
he
cked').val()
--------------------------------------------------------------------------------------------------
//
checked
是否选择全部
function
getContentIds()
{
var
ids=
new
Array();
$(
"input[name='phids']"
).each(
function
()
{
if
($(
this
).attr(
"checked"
))
{
ids.push($(
this
).val());
}
}
);
return
ids;
}
--------------------------------------------------------------------------------------------------
javascript解决url传参中文乱码问题
(2012-09-03 16:02:44) 标签: javascript中文乱码杂谈 | 分类: Java |