var v1 =$('#tota').val(); //获取的id = v1的为字符串
var v = parseInt(v1);//parseInt转类型
页面刷新
window.location.reload();
请求
window.open('url');
localaction='url';
open操作
<input name="cat_name" type="text" id="cat_name" value="$!obj.category.name" />
<select id="myoption" οnchange="selectInput(this)">
#foreach($cate in $categorys)
<option value="$cate.name">$cate.name</option>
#end
</select>
<script>
function selectInput(a){
document.getElementById('cat_name').value= a.value;
}
</script>//获取点击的open加入到输入框
//select下所有open
document.getElementById('myoption').onclick = function(){
var str = $("#myoption option").map(function(){
var opt = $(this).val();
alert(opt)
}).get().join(", ")
};
//提交form表单
<form action="${ctx}/admin/userLogin" name="aform" id="aform" method="post">
<form>
<script>
$("#aform").submit();
</script>
//获取UL下的Li和改变
<ul class="tab pngFix">
<li id="1" class="active" οnclick="ownership()"><a href="javascript:void(0);">所有订单</a></li>
<li id="2" class=""οnclick="ownership1()"><a href="javascript:void(0);" >待付款</a></li>
<li id="3" class=""οnclick="ownership2()"><a href="javascript:void(0);">待发货</a></li>
</ul>
<script>
/* var v = document.getElementById("1");//
v.className="active"*/
$(function() {
var ids = document.getElementById("1")
var ids1 = document.getElementById("2")
$('.tab li a').click(function(){ //获取UL的class
$('.tab li').removeClass('active');
$(this).parent().addClass('active');
})
})
</script>
//html下拉列表选择事件
<td class="w100">
<select name="order_status" id="order_status" οnchange="testClk()">
<option value="" selected="">所有订单</option>
<option value="order_submit">待付款</option>
<option value="order_pay">待发货</option>
<option value="order_shipping">已发货</option>
<option value="order_receive">已收货</option>
<option value="order_finish">已完成</option>
<option value="order_cancel">已取消</option>
</select></td>
<script>
function testClk(){
var obj = document.getElementById("order_status");
jQuery('#ListForm').submit();//form的ID
}
</script>
//js控制radio
<input name="c.type" type="radio"id="0" value = "0" checked="checked" class="colored-blue">
<input name="c.type" id="1" type="radio"value = "1"class="colored-blueberry">
$("input[name='c.type']").eq(1).attr("checked","checked");
$("input[name='c.type']").eq(0).removeAttr("checked");
databalse下的获取span值 :$(".tagnames").text() //tagnames为class