除以下代码外,再导入个jquery-1.4.4.min.js文件 ,代码中收件人是写死的("ABC", "ABCDEF", "BCDEF"),已测试通过!
复制代码 代码如下:
<%@ page language="java" import="java.util.*" pageencoding="utf-8" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="Cache-Control" content="no-cache">
<title></title>
<script type="text/javascript" src="/UploadFiles/2021-04-02/jquery-1.4.4.min.js"><style>
.clickcss a:link
{
text-decoration: none;
}
.clickcss a:hover
{
background-color: #CCCCCC;
}
.clickcss a:active
{
background-color: blue;
}
</style>
<script language="javascript" type="text/javascript">
$(document).ready(
function() {
$(document).keydown(
function(event) {
if (event.keyCode == 46) {
var containner = $("#div1 span").eq(0);
containner.find("a").each(function() {
if ($(this).css('background-color') == 'blue') {
$(this).remove();
}
});
if (containner.find("a").length == 0) {
containner.css("width", "0");
}
}
});
});
function check() {
//<%=value %>
var array = new Array("ABC", "ABCDEF", "BCDEF");
var result = null;
var aobject = null;
var value = $("#input1").val();
var containner = $("#div1 span").eq(0);
if (value == "") {
alert("请输入收件人名称!")
}
else {
result = new Array();
for (var i = 0; i < array.length; i++) {
if (contains(array[i], value, true)) {
result.push(array[i]);
}
}
if (result.length == 0) {
alert("不包含当前输入的收件人信息,请重新输入!");
}
else if (result.length == 1) {
alert("添加一个收件人!");
containner.css("width", "100%");
containner.append("<a href='javascript:' >" + result[0] + ";</a>");
}
else if (result.length > 1) {
alert("有" + result.length + "个匹配信息,弹出选择对话框选择!");
// window.open("dialog.html", "请选择", "height=100,width=400,top=0,left=0,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no,alwaysRaised=yes,z-look=yes");
window.open("dialog.html");
}
}
}
function contains(string, substr, isIgnoreCase) {
if (isIgnoreCase) {
string = string.toLowerCase();
substr = substr.toLowerCase();
}
var startChar = substr.substring(0, 1);
var strLen = substr.length;
for (var j = 0; j < string.length - strLen + 1; j++) {
if (string.charAt(j) == startChar)//如果匹配起始字符,开始查找
{
if (string.substring(j, j + strLen) == substr)//如果从j开始的字符与str匹配,那ok
{
return true;
}
}
}
return false;
}
</script>
</head>
<body style="padding: 0 0; margin: 0 0;">
<div id="div1" style="background-color: #22dd22; width: 100%">
<span class="clickcss" style="background-color: #00ff00;"></span><span style="width: 100%">
收件人:<input id="input1" /></span>
</div>
<button id="button1" onclick="check();" />
检查</button>
</body>
</html>
复制代码 代码如下:
<%@ page language="java" import="java.util.*" pageencoding="utf-8" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="Cache-Control" content="no-cache">
<title></title>
<script type="text/javascript" src="/UploadFiles/2021-04-02/jquery-1.4.4.min.js"><style>
.clickcss a:link
{
text-decoration: none;
}
.clickcss a:hover
{
background-color: #CCCCCC;
}
.clickcss a:active
{
background-color: blue;
}
</style>
<script language="javascript" type="text/javascript">
$(document).ready(
function() {
$(document).keydown(
function(event) {
if (event.keyCode == 46) {
var containner = $("#div1 span").eq(0);
containner.find("a").each(function() {
if ($(this).css('background-color') == 'blue') {
$(this).remove();
}
});
if (containner.find("a").length == 0) {
containner.css("width", "0");
}
}
});
});
function check() {
//<%=value %>
var array = new Array("ABC", "ABCDEF", "BCDEF");
var result = null;
var aobject = null;
var value = $("#input1").val();
var containner = $("#div1 span").eq(0);
if (value == "") {
alert("请输入收件人名称!")
}
else {
result = new Array();
for (var i = 0; i < array.length; i++) {
if (contains(array[i], value, true)) {
result.push(array[i]);
}
}
if (result.length == 0) {
alert("不包含当前输入的收件人信息,请重新输入!");
}
else if (result.length == 1) {
alert("添加一个收件人!");
containner.css("width", "100%");
containner.append("<a href='javascript:' >" + result[0] + ";</a>");
}
else if (result.length > 1) {
alert("有" + result.length + "个匹配信息,弹出选择对话框选择!");
// window.open("dialog.html", "请选择", "height=100,width=400,top=0,left=0,toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no,alwaysRaised=yes,z-look=yes");
window.open("dialog.html");
}
}
}
function contains(string, substr, isIgnoreCase) {
if (isIgnoreCase) {
string = string.toLowerCase();
substr = substr.toLowerCase();
}
var startChar = substr.substring(0, 1);
var strLen = substr.length;
for (var j = 0; j < string.length - strLen + 1; j++) {
if (string.charAt(j) == startChar)//如果匹配起始字符,开始查找
{
if (string.substring(j, j + strLen) == substr)//如果从j开始的字符与str匹配,那ok
{
return true;
}
}
}
return false;
}
</script>
</head>
<body style="padding: 0 0; margin: 0 0;">
<div id="div1" style="background-color: #22dd22; width: 100%">
<span class="clickcss" style="background-color: #00ff00;"></span><span style="width: 100%">
收件人:<input id="input1" /></span>
</div>
<button id="button1" onclick="check();" />
检查</button>
</body>
</html>
标签:
Email,收件人
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
狼山资源网 Copyright www.pvsay.com
暂无“jQuery实现的Email中的收件人效果(按del键删除)”评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。