在 phonegap 中,我使用了一个 jquery 移动框架。我想通过使用页面 url 将表单数据传递到下一页,这是一个 div。我尝试使用 GetElementByID 来检索参数searchlocation
。它可能无法工作。无法检索该参数,它不会转到下一页。我该如何解决?
下面是转换到下一页的功能 DIV 是我的phonegap的代码:
<script type="text/javascript">
$('#home').live('pagecreate',function(event) {
$("#form").submit( function (e) {
e.preventDefault();
var x=document.getElementById("searchlocation");
$.mobile.changePage("#page1?param1="+x);
});
});
</script>
和表单html:
<form id="form" method="POST" action="page1" data-ajax="false">
<div data-role="fieldcontain" id="search">
<fieldset data-role="controlgroup">
<label for="search">
Search
</label>
<input name="searchword" id="searchword" placeholder="" value="" type="search" />
</fieldset>
</div>
<div data-role="fieldcontain" id="searchcondition">
<label for="searchmethod">
</label>
<select id="searchmethod" name="searchmethod" data-theme="e">
<option value="keyword">
Keyword
</option>
</select>
</div>
<div data-role="fieldcontain2" id="searchcondition2">
<label for="searchlocation2">
</label>
<select id="searchlocation" name="searchlocation" data-theme="e">
<option value="Entire Collection">
Entire Collection
</option>
<option value="Pearl River Delta and Yangtze River Delta Collection">
Pearl River Delta and Yangtze River Delta Collection
</option>
</select>
</div>
<input type="submit" value="Submit" />
</form>