我已经设置了一个框来显示Ajax表格的结果,显示来自美国地质调查局的水数据并使用Google图表。效果很好,但我希望用户在第一次加载表单而不是空框时看到一些示例结果。不知道怎么做。以下是表单的代码:
<table bgcolor="tan" width="480px" height="450px"><tr><td>
<h2>Current River Levels</h2></td><td>
<form>
<select name="users"; onchange="showUser(this.value); drawChart(this.value)";>
<option value="01598500">North Branch at Luke, MD</option>
<option value="01603000">North Branch at Cumberland, MD</option>
<option value="01610000">Potomac River at Paw Paw, WV</option>
<option value="01613000">Potomac River at Hancock, MD</option>
<option value="01619500">Antietam Creek at Sharpsburg, MD</option>
<option value="01638500">Potomac River at Point of Rocks, MD</option>
<option value="01648000">Rock Creek at Sherrill Drive, DC</option>
<option value="01646500">Little Falls, DC</option>
</select>
</form></td></tr><td colspan="2">
<div id="placeholder"></div>
<div id="placeholder2"></div>##
<div id="chart" style="width:100%"></div>
<div id="txtHint"><b>Select a site or visit our <a href="../monitoring_map.php4" target="_blank">interactive map.</a></b></div>
整个项目位于:http://www.riverexplorer.com/potomax/json_test_20.php
答案 0 :(得分:1)
文档准备好后触发onchange事件。
$(function(){
$('select[name="users"]').trigger('change');
});