更多>
最新下载
jQuery自动填充表单功能代码
jQuery自动填充表单功能代码是一款利用jQueryUI的autocomplate工具实现表单的自动填充功能,数据可通过ajax从后台获取,或者从文本文件中获取都可。
0
2026-01-28
Vue记事本添加删除特效
使用vue制作简单的文本框输入关键词创建或删除计划事项记事本功能效果。可用于生活记事本备忘录特效。使用方法:参数介绍:新增(1、生成列表结构 v-for 和数组 2、获取用户输入 v-model 3、回车,新增数据 v-on .enter)--删除(数据改变和数据绑定的元素是同步变化的;时间的自定义参数;splice方法的应用)---计数(统计信息个数length)--清除(点击清除所有信息 v-
0
2026-01-28
24小时阅读排行榜
- 1 如何利用CSS3做出漂亮的渐变效果_制作流畅的背景渐变效果
- 2 C++虚函数有什么用 C++多态实现原理与代码演示【进阶】
- 3 Go语言如何编写表驱动测试_表驱动测试写法解析
- 4 Go语言命名规范有哪些_Golang基础编码规范说明
- 5 c++如何计算两个日期的间隔_c++时间戳计算方法【实战】
- 6 如何搭建mysql调试环境_mysql问题排查环境
- 7 mysql MyBatis是什么_mysql持久层框架讲解
- 8 css not 选择器可以组合使用吗_否定选择规则说明
- 9 Go反射为什么需要指针 Golang反射修改值原理说明
- 10 php实现班级通信录怎么导入mysql_php导入数据入库方法【步骤】
- 11 kali怎么挖php漏洞_用golismero整合扫描php多漏洞【技巧】
- 12 PowerShell如何从XML文件中导出数据到CSV
- 13 mysql面试为什么常问SQL执行流程_高频考点解析
- 14 c# 如何在高并发下保证数据库迁移(EF Core Migration)的安全性
- 15 C++ 怎么判断文件是否为空 C++ seekg与tellg检查文件大小代码【IO】
更多>
最新教程
-
- Node.js 教程
- 16322 2025-08-28
-
- CSS3 教程
- 1547008 2025-08-27
-
- Rust 教程
- 23437 2025-08-27
-
- Vue 教程
- 25873 2025-08-22
-
- PostgreSQL 教程
- 22375 2025-08-21
-
- Git 教程
- 9325 2025-08-21
js输入关键词生成标签代码
js代码
<script type="text/javascript">
var tagcon = $("tagcon");
var addBox = $("addBox");
var addBtn = addBox.children[1];
var intxt = addBox.children[0];
var divs = tagcon.children;
function $(id){ return document.getElementById(id) }//$获取元素函数封装
function crele(ele){ return document.createElement(ele); } //创建元素
function adson(father,son1,son2,son3,clas1,clas2,clas3,clas4,con1,con2){
father.appendChild(son1);
father.appendChild(son2);
father.appendChild(son3);
father.className = clas1;
son1.className = clas2;
son2.className = clas3;
son3.className = clas4;
son1.innerHTML = con1;
son3.innerHTML = con2;
}
//输入框聚焦和失焦的效果
intxt.onfocus = function(){
intxt.style.backgroundColor = "#fff";
}
intxt.onblur = function () {
intxt.style.backgroundColor = "#e3e3e3";
}
//点击add按钮添加标签
addBtn.onclick = function () {
if(intxt.value != ""){
var newdiv = crele("div");
var newem = crele("em");
var newspan = crele("span");
var newa = crele("a");
if(divs.length == 0){//最新添加的标签在最前边
tagcon.appendChild(newdiv);
}else{
tagcon.insertBefore(newdiv,divs[0])
}
adson(newdiv,newem,newspan,newa,"tag","tagtxt","move","closetag",intxt.value,"×")
intxt.value = "";
}else{
alert("你还没有输入呢!");
}
//console.log(links.length);
newa.onclick = function () {
this.parentNode.style.display = "none";
}
}
</script>
本站所有资源都是由网友投搞发布,或转载各大下载站,请自行检测软件的完整性!本站所有资源仅供学习与参考,请勿用于商业用途,否则产生的一切后果将由您自己承担!如有侵权请联系我们删除下架,联系方式:admin@php.cn
