解决方案 »
- js下载pdf文件
- JavaScript怎么获得listview编辑模式下的一个label服务器控件的ID
- 如何将同一个页面上的textarea的值赋给另一个textarea
- jsp的一个小问题,很急,各位帮帮忙谢谢
- 怪问题:無法判定字串常數的結尾(本地服务器测试ok,台湾服务器就出现这个问题)
- 求一棵数,带cookies,如果刷新页面还能保持当前打开结构的
- 新浪微博jssdk登陆问题
- 求好心人帮忙,制作选课插件
- 想在iframe里显示纯文本,就像在textarea里一模一样,帮帮我!
- 能不能停止javascript程序5秒,5秒后执行没有执行完的程序。请教如下:
- setTimeOut失效问题
- js动态添加文本框实现autocomplete效果
$("#title1").val($("title").eq(0));
<script type="text/javascript">
$(document).ready(function(){
$.ajax({
url:"xml.xml",
type:"GET",
dataType:"xml",
success:function(data){
$(data).find("book").each(function(){
var $book=$(this);
var $index=$book.attr("index");
$("#name"+$index).val($book.find("name").text());
$("#title"+$index).val($book.find("title").text());
});
}
});
});
</script>
<script>
$(function(){
$('xml').find("book").each(function(){
var note = $(this);
var index = note.attr("index");
$("#name" + index).val(note.find("name").text());
$("#title" + index).val(note.find("title").text());
});
});
</script>
<xml>
<?xml version="1.0" encoding="utf-8"?>
<info>
<List>
<book index="1">
<author index="1">
<name>张1三</name>
<title>标题1</title>
</author>
</book>
<book index="2">
<author index="2">
<name>张三2</name>
<title>标题2</title>
</author>
</book>
<book index="3">
<author index="3">
<name>张三3</name>
<title>标题3</title>
</author>
</book>
</List>
</info>
</xml><table cellspacing="0" cellpadding="0" style="width:500px;">
<tr style="background:#dedede; height:25px;">
<td class="scheduletd" style="width:100px;">选择</td>
<td class="scheduletd" style="width:100px;">序号</td>
<td class="scheduletd" style="width:100px;">姓名</td>
<td class="scheduletd" style="width:100px;">标题</td>
</tr>
<tr style="height:25px;">
<td ><input type="checkbox" name="CheckboxTime" id="checkbox1" /></td>
<td>1</td>
<td><input id="name1" name="name1" style="width:100px;"></td>
<td><input id="title1" name="title1" style="width:100px;"></td>
</tr>
<tr style="height:25px;">
<td ><input type="checkbox" name="CheckboxTime" id="checkbox2" /></td>
<td>2</td>
<td><input id="name2" name="name2" style="width:100px;"></td>
<td><input id="title2" name="title2" style="width:100px;"></td>
</tr>
<tr style="height:25px;">
<td ><input type="checkbox" name="CheckboxTime" id="checkbox2" /></td>
<td>3</td>
<td><input id="name3" name="name3" style="width:100px;"></td>
<td><input id="title3" name="title3" style="width:100px;"></td>
</tr>
<tr style="height:25px;">
<td ><input type="checkbox" name="CheckboxTime" id="checkbox2" /></td>
<td>4</td>
<td><input id="name4" name="name4" style="width:100px;"></td>
<td><input id="title4" name="title4" style="width:100px;"></td>
</tr>
</table>