怎么做类似csdn这种标签输入效果 javascriptjquery特效 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <html><head> <title>Index</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type="text/javascript" src="http://cloud.xing-xing.com/jquery.js"></script> <style> .tagPanel{position:relative;} .tagSpan{position: absolute;z-index: 101;float: left;top: 1px;} .tagPanel .tagSpan span{cursor: default;display: inline-block;border: solid 1px #ccc;background-color: #ffffcc;border-radius: 5px;padding: 2px 4px;margin-right: 4px;} .tagPanel input{padding-left:3px;outline:none;} </style></head><body><div id="tagPanel" class="tagPanel" style="border:1px gray solid; height:25px width:200px;"><div class="tagSpan"></div><input type="text" style="border:0; width:100%;height:25px;" id="tag"/></div></body><script>$(function () { $("#tag").blur(function(){ var val = $(this).val(); if(val){ $("<span>"+val+"</span>").appendTo($(".tagSpan")); resizeInput(); $(this).val(""); } }).keyup(function(evt){ if(evt.which == 8){ $(".tagPanel span:last").remove(); resizeInput(); } }); $(".tagPanel span").live("click",function(){ var $spans = $(this).remove(); resizeInput(); });});function resizeInput(){ var panelWidth = $("#tagPanel").css("width"); panelWidth = panelWidth.substring(0, panelWidth.length-2); var tagWidth = $(".tagSpan").css("width"); vtagWidth = tagWidth.substring(0, tagWidth.length-2); var inputWidth = panelWidth - tagWidth; $('#tag').css({"width":inputWidth,"marginLeft":tagWidth});}</script></html> 单选答题 谁能得到这个ajax的目标网址,并用脚本取出内容? setTimeout函数执行 某个对象本身的方法函数,怎么写也不对,救急。 用以下移动表中的行顺序后,怎么保存最后的行顺序? 如何利用控制图片的大小 请教如何在网页中设置快捷键 怎樣把數組裡所有有的元素求和 怎样返回页面第一次加载时的页面呢?? 怎样检索对象的方法? 谷歌浏览器执行html()方法加载很慢 将后台的数据转为json传到前台js表格无法显示,但josn里面有值 请教JQUERY代码
<head>
<title>Index</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://cloud.xing-xing.com/jquery.js"></script>
<style>
.tagPanel{position:relative;}
.tagSpan{position: absolute;z-index: 101;float: left;top: 1px;}
.tagPanel .tagSpan span{cursor: default;display: inline-block;border: solid 1px #ccc;background-color: #ffffcc;border-radius: 5px;padding: 2px 4px;margin-right: 4px;}
.tagPanel input{padding-left:3px;outline:none;}
</style>
</head>
<body>
<div id="tagPanel" class="tagPanel" style="border:1px gray solid; height:25px width:200px;">
<div class="tagSpan">
</div>
<input type="text" style="border:0; width:100%;height:25px;" id="tag"/>
</div>
</body>
<script>
$(function () {
$("#tag").blur(function(){
var val = $(this).val();
if(val){
$("<span>"+val+"</span>").appendTo($(".tagSpan"));
resizeInput();
$(this).val("");
}
}).keyup(function(evt){
if(evt.which == 8){
$(".tagPanel span:last").remove();
resizeInput();
}
});
$(".tagPanel span").live("click",function(){
var $spans = $(this).remove();
resizeInput();
});
});function resizeInput(){
var panelWidth = $("#tagPanel").css("width");
panelWidth = panelWidth.substring(0, panelWidth.length-2);
var tagWidth = $(".tagSpan").css("width");
vtagWidth = tagWidth.substring(0, tagWidth.length-2);
var inputWidth = panelWidth - tagWidth;
$('#tag').css({"width":inputWidth,"marginLeft":tagWidth});
}
</script>
</html>