日期:2014-05-16 浏览次数:20410 次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title></title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script> <script type="text/javascript"> function test() { alert("有id的input的下一个input的值为:"+$("#listbox_DS_Panel_55").next().val()); } </script> </head> <body> <div class="select_div" style="width:122px;"> <input X:TableName='Z_ZDWPLY' X:ResetAble='false' class="select_text" type='text' value='半个月' X:XPath='V07SHOW' X:Action='0' ds_field='Z_ZDWPLY.V07' X:Caption='公开时限' id='listbox_DS_Panel_55' X:DataUrl="action?QueryTable=g_code&C=name as V07SHOW, value as V07&F=PID=68723685453000016&S=ItemIndex" style='width:100px;;' name='list7' readonly /> <input type='hidden' X:ResetAble='false' X:DefaultValue='15' value='15' X:TableName='Z_ZDWPLY' X:XPath='V07'/> <input class="select_button" type="button" onclick='showListBox(this);' style='cursor: hand' /> </div> <input type="button" id="done" value="Test" onclick="test()" /> </body> </html>
------解决方案--------------------
var formInput = document.getElementsByTagName('input'); alert(formInput.item(1).value); //第二个input的值 ,item(0)表示第一个标签元素,item(1)表示第二个,以此类推 alert(formInput.item(2).value); //第三个input的值
------解决方案--------------------
alert($("input:eq(2)").val());
引用jquery JS