解决方案 »
- easyui的datagrid批量处理时的问题
- jQuery easyUI 局部ajax刷新后,无法响应点击事件(在线等,先谢谢各位)
- 在服务器发布含有javascript脚本网页,客户端使用不正常
- jquery 有没有函数将textarea中的换行等内容转换为html标记
- ID相同,value不同,我怎么才能获取value
- 跨域 实现iframe 高度自动适应
- 用JAVASCRIPT 输出任意六张图片到网页固定层中的方法?有类似代码请分享.
- 求一个正则表达式
- JK献芹:有关日期手工输入验证、日期弹出框、数值输入验证、必须输入验证等(共三个文件)
- 1000分悬赏,不相信没人能解决!!!分十次给!!
- 还原JS代码
- 一个浏览器插件,但是需要输入注册码,JS的,有人懂吗?
function demo(){
var p_text = $(".ck").html();
document.write(p_text);
}
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>行程编辑小助手(Yousc.com wujun Inc.)</title>
<style type="text/css">
em{ font-style: normal; }
* {margin:0;padding:0;font-size:12px;list-style:none;border:0;}
body{ margin:0px; padding:0px; background-color:#f0f0f0; font-family:Arial, Helvetica, sans-serif;}
a{ text-decoration:none;}
.top{ width:970px; height:30px; border-bottom:1px solid #dbdbdb; margin:0px auto;}
.logo{ width:300px; height:30px; line-height:30px; float:left; font-size:14px; margin:0px 5px;}
.clear{ display:block; height:0px; line-height:0px; font-size:0px; clear:both;}
.shanchu{ width:14px; height:14px; margin:3px 17px; display:block; float:right; background:url(images/bg_mj.png) no-repeat 0px -661px; cursor:pointer;}
.zj{ width:922px; height:22px; padding:10px 14px; font-size:12px;}
.zj_an{ display:block; width:83px; height:22px; float:left; background:url(images/bg_mj.png) no-repeat 0px -695px; cursor:pointer;}
.zj_ts{display:block; height:22px; float:left; color:#ff075b; line-height:22px; padding-left:10px;}
.zj_input_a{float:right; margin:5px 5px 0px 0px; _margin:1px 1px 0px 0px;}
.zj_bc{display:block; height:22px; float:right; line-height:22px; color:#555555;cursor:pointer;}
.box{ width:950px; height:auto; margin:0px auto; border-top:1px solid #f9f9f9; padding:30px 10px;}
.ck{ width:950px; height:auto; padding-top:10px;}
.day_list{width:950px; height:55px; padding:10px 0px; color:#555555; font-size:12px; border-bottom:1px solid #dddddd;}
.h2_title{height:22px; display:block; padding:0px 7px 0px 14px; line-height:22px; float:left;}
.h2_title_a{ width:133px; height:20px; float:right; border:1px solid #bababa; padding:0px 2px; _height:17px; _padding:3px 2px 0px 2px; margin-left:4px;}
.ctain{font-weight:bold;height:33px; display:block; padding:0px 5px 0px 0; line-height:22px; float:left;}
.ctain li{font-weight:bold;height:22px; display:block; padding:0px 7px 0px 14px; line-height:22px; float:left;}
.ctain_d{ width:520px; height:20px; float:right; border:1px solid #bababa; padding:0px 2px; _height:17px; _padding:3px 2px 0px 2px; margin:0px 36px 0px 6px;}
.ctain_e{ width:95px; height:20px;border:1px solid #bababa; padding:0px 2px; _height:17px; _padding:3px 2px 0px 2px; margin:0px 36px 0px 6px;}
</style>
<script type="text/javascript" src="images/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".shanchu").click(function(){
if ($(".day_list").size() > 1) {
$(this).parent().remove();
} else {
$(".zj_ts").html("一个行程至少有1天");
}
});
$(".zj_an").click(function(){
$(".ck").append($(".day_list:first").clone(true));
$(".zj_ts").html("");
});
});
</script>
</head>
<body>
<div class="top">
<div class="logo">行程编辑小助手</div>
<div class="clear"></div>
</div>
<div class="box">
<div class="ck" id="ck">
<div class="day_list">
<h2 class="h2_title">第1天 >><input name="" type="text" class="h2_title_a" id="num-a"/></h2>
<p class="ctain">行程内容:<input name="" type="text" class="ctain_d" id="num-b"/></p>
<ul class="ctain">
<li><strong>用餐</strong> 早餐:<input name="" type="text" class="ctain_e" id="num-c"/> 午餐:<input name="" type="text" class="ctain_e" id="num-d"/> 晚餐:<input name="" type="text" class="ctain_e" id="num-e"/></li>
<li><strong>住宿</strong> <input name="" type="text" class="h2_title_a" id="num-f"/></li>
</ul>
<span class="shanchu"></span>
</div>
</div>
<div class="zj">
<span class="zj_an"></span>
<span class="zj_ts"></span>
<span class="zj_bc" onclick="demo()">保存html代码</span>
<span class="clear"></span>
</div>
</div>
<script type="text/javascript">function demo(){
var p_text = $(".ck").html();
document.write(p_text);
}
function doCopy(obj){ var codeObj = document.getElementById(obj); clipboardData.setData('text', codeObj.innerText); alert('已经复制代码'); }</script>
</body>
</html>////demo() doCopy都是做的测试
function tt(t){
$(t).attr('value',$(t).val());
}然后复制就input就有值了,刚已经试过。
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>行程编辑小助手(Yousc.com wujun Inc.)</title>
<style type="text/css">
em{ font-style: normal; }
* {margin:0;padding:0;font-size:12px;list-style:none;border:0;}
body{ margin:0px; padding:0px; background-color:#f0f0f0; font-family:Arial, Helvetica, sans-serif;}
a{ text-decoration:none;}
.top{ width:970px; height:30px; border-bottom:1px solid #dbdbdb; margin:0px auto;}
.logo{ width:300px; height:30px; line-height:30px; float:left; font-size:14px; margin:0px 5px;}
.clear{ display:block; height:0px; line-height:0px; font-size:0px; clear:both;}
.shanchu{ width:14px; height:14px; margin:3px 17px; display:block; float:right; background:url(images/bg_mj.png) no-repeat 0px -661px; cursor:pointer;}
.zj{ width:922px; height:22px; padding:10px 14px; font-size:12px;}
.zj_an{ display:block; width:83px; height:22px; float:left; background:url(images/bg_mj.png) no-repeat 0px -695px; cursor:pointer;}
.zj_ts{display:block; height:22px; float:left; color:#ff075b; line-height:22px; padding-left:10px;}
.zj_input_a{float:right; margin:5px 5px 0px 0px; _margin:1px 1px 0px 0px;}
.zj_bc{display:block; height:22px; float:right; line-height:22px; color:#555555;cursor:pointer;}
.box{ width:950px; height:auto; margin:0px auto; border-top:1px solid #f9f9f9; padding:30px 10px;}
.ck{ width:950px; height:auto; padding-top:10px;}
.day_list{width:950px; height:55px; padding:10px 0px; color:#555555; font-size:12px; border-bottom:1px solid #dddddd;}
.h2_title{height:22px; display:block; padding:0px 7px 0px 14px; line-height:22px; float:left;}
.h2_title_a{ width:133px; height:20px; float:right; border:1px solid #bababa; padding:0px 2px; _height:17px; _padding:3px 2px 0px 2px; margin-left:4px;}
.ctain{font-weight:bold;height:33px; display:block; padding:0px 5px 0px 0; line-height:22px; float:left;}
.ctain li{font-weight:bold;height:22px; display:block; padding:0px 7px 0px 14px; line-height:22px; float:left;}
.ctain_d{ width:520px; height:20px; float:right; border:1px solid #bababa; padding:0px 2px; _height:17px; _padding:3px 2px 0px 2px; margin:0px 36px 0px 6px;}
.ctain_e{ width:95px; height:20px;border:1px solid #bababa; padding:0px 2px; _height:17px; _padding:3px 2px 0px 2px; margin:0px 36px 0px 6px;}
</style>
<script type="text/javascript" src="images/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(".shanchu").click(function(){
if ($(".day_list").size() > 1) {
$(this).parent().remove();
} else {
$(".zj_ts").html("一个行程至少有1天");
}
});
$(".zj_an").click(function(){
$(".ck").append($(".day_list:first").clone(true));
$(".zj_ts").html("");
});
});
</script>
</head>
<body>
<div class="top">
<div class="logo">行程编辑小助手</div>
<div class="clear"></div>
</div>
<div class="box">
<div class="ck" id="ck">
<div class="day_list">
<h2 class="h2_title">第1天 >><input name="" type="text" class="h2_title_a" id="num-a"/></h2>
<p class="ctain">行程内容:<input name="" type="text" class="ctain_d" id="num-b"/></p>
<ul class="ctain">
<li><strong>用餐</strong> 早餐:<input name="" type="text" class="ctain_e" id="num-c"/> 午餐:<input name="" type="text" class="ctain_e" id="num-d"/> 晚餐:<input name="" type="text" class="ctain_e" id="num-e"/></li>
<li><strong>住宿</strong> <input name="" type="text" class="h2_title_a" id="num-f"/></li>
</ul>
<span class="shanchu"></span>
</div>
</div>
<div class="zj">
<span class="zj_an"></span>
<span class="zj_ts"></span>
<span class="zj_bc" onclick="demo()">保存html代码</span>
<span class="clear"></span>
</div>
</div>
<script type="text/javascript">function demo(){
var p_text = $(".ck").html();
document.write(p_text);
}
function doCopy(obj){ var codeObj = document.getElementById(obj); clipboardData.setData('text', codeObj.innerText); alert('已经复制代码'); }</script>
</body>
</html>////demo() doCopy都是做的测试
兼容性可以先不用考虑clipboardData只支持ie
怎么样才能只读出input的值而不是连带imput框一起输出,类似存进数据库里面的html代码
Write less, do more.
寫那麼多就不是jquery了jQuery 有 Clone 的方法http://api.jquery.com/clone/
http://jsfiddle.net/oc8d1wyp/
var tx = $("#tx").val();
document.write($("#dd").html());
$("#tx").val(tx);
如果你不要input框,那复制干嘛?