下面这js怎么兼容firefox和chrome啊我试了就ie可以,
<!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="../Js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("#Button1").click(function () {
$("#table2").html($("#table1").html())
}) })
</script>
</head>
<body>
<table id="table1" class="tableTemp" cellpadding="2px" cellspacing="0" style="border-collapse: collapse"
border="1px" bordercolor="#CCCCCC">
<tbody>
<tr>
<th>
测试下拉框
</th>
<th>
测试文本框
</th>
</tr>
<tr>
<td>
<select class="input">
<option value="是">是</option>
<option value="否">否</option>
</select>
</td>
<td>
<input class="input" type="text">
</td>
</tr>
</tbody>
</table>
<br />
<br />
<table id="table2" class="tableTemp" cellpadding="2px" cellspacing="0" style="border-collapse: collapse"
border="1px" bordercolor="#CCCCCC">
</table>
<input id="Button1" type="button" value="button" />
</body>
</html>
<!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="../Js/jquery-1.3.2.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () {
$("#Button1").click(function () {
$("#table2").html($("#table1").html())
}) })
</script>
</head>
<body>
<table id="table1" class="tableTemp" cellpadding="2px" cellspacing="0" style="border-collapse: collapse"
border="1px" bordercolor="#CCCCCC">
<tbody>
<tr>
<th>
测试下拉框
</th>
<th>
测试文本框
</th>
</tr>
<tr>
<td>
<select class="input">
<option value="是">是</option>
<option value="否">否</option>
</select>
</td>
<td>
<input class="input" type="text">
</td>
</tr>
</tbody>
</table>
<br />
<br />
<table id="table2" class="tableTemp" cellpadding="2px" cellspacing="0" style="border-collapse: collapse"
border="1px" bordercolor="#CCCCCC">
</table>
<input id="Button1" type="button" value="button" />
</body>
</html>
解决方案 »
- JS怎么获取客户端物理网卡的的MAC地址,而不是获取虚拟或PPPOE的MAC地址呢?
- html传参数给javascript的问题
- flash显示为灰色的问题
- Ext中formPanel中嵌套tabPanel有效性验证的提示图标问题
- ext中label的显示问题(图),求高手解答
- Object,Object.prototype, Function,Function.prototyp谁是老大?
- js创建两个对象,为什么会互相干扰?new xxxx
- 如何获得相同ID的sourceIndex啊?程序后台被人写死了,只能改脚本了,惨!!!
- 中国制造!媲美奔腾3的龙芯2号首次公开曝光[图]
- JavaScript调用ActiveXForm方法,怎样传送字符串参数?
- 请教:如何把一个表单中元素的值赋给另一个表单中的元素
- js传值的问题?
有问题啊。。下拉框全部选择成否。。文本框写值,用google,firefox试试就知道了
应该不是这个问题,google,firefox选择的时候,是不是没有那个selected=true.
这个可以,,我最终是要获取html保存到数据库中。。
if($.browser.msie){
$("#table2").html($("#table1").html())
}else{
var _backup = $("#table1").clone();
_backup.find('select').val($("#table1").find('select').val());
$("#table2").html(_backup)
}
alert截图如下
ie下下可以生成selected=true,但是google,和firefox不行有没有其他方法
if($.browser.msie){
$("#table2").html($("#table1").html())
}else{
var _backup = $("#table1").clone();
_backup.find('select').children().each(function(index){
if($(this).val()==$("#table1").find('select').val()){
this.setAttribute('selected' , true);
}
});
$("#table2").html(_backup);
}