手机
当前位置:查字典教程网 >编程开发 >asp.net教程 >asp.net 页面版文本框智能提示JSCode (升级版)
asp.net 页面版文本框智能提示JSCode (升级版)
摘要:原本准备在上一篇中直接修改的,无奈编辑功能太差,打开一堆html代码,空格“ ”都看的人眼花缭乱,只好另开一篇。升级说明:添加了针对...

原本准备在上一篇中直接修改的,无奈编辑功能太差,打开一堆html代码,空格“ ”都看的人眼花缭乱,只好另开一篇。

升级说明:添加了针对一个界面多个职能提示位置的设定,只需修改文本框onfocus="fnStartInterval(this,'DropDownList2')",

设置好相应的参数即可,同时修复了在IE6下div无法遮盖下拉列表的问题,(IE6下无论如何设置select的z-index或div的z-index属性均无济于事),关于这个就是利用了一个iframe,将其盖在div要显示的位置,然后div再放在iframe上方即可。即使下方有select元素,也没关系了。下面是最新code:

复制代码 代码如下:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AutoTemple.aspx.cs" Inherits="AutoTemple" %>

<!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 runat="server">

<title>无标题页</title>

<style type="text/css"><></style>

<script type="text/javascript" language="javascript"><;

document.getElementById("divsearch_"+tempDiv[currentIndex]).style.backgroundColor="#3366CC";

}

else if (event.keyCode == 40 && currentIndex < sumSearchCount-1)

{

currentIndex++;

document.getElementById("divsearch_"+tempDiv[currentIndex]).style.backgroundColor="#3366CC";

}

else if (event.keyCode == 13)

{

if(currentIndex > -1)

{

var divpart = document.getElementById("divsearch_"+tempDiv[currentIndex]);

objTxt.value=divpart.innerHTML;

document.getElementById(ddlName).options[tempDiv[currentIndex]].selected="selected";

clear();

//document.getElementById(ddlName).fireEvent("onchange");

//document.form1.onsubmit=function (){return false;};

}

}

}

}

}

// --></script>

</head>

<body>

<form id="form1" runat="server">

<div>

<input type="text" id="txtSearch" autocomplete="off" onkeydown="changeSelect()" onfocus="fnStartInterval(this,'DropDownList1')" onblur="closeSearch()" />

<asp:DropDownList ID="DropDownList1" runat="server" DataTextField="slr_realname" DataValueField="systemloginrecord_id" DataSourceID="ObjectDataSource1" Width="130px" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">

</asp:DropDownList><asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetRecordDS"

TypeName="TestDAL"></asp:ObjectDataSource>

</div>

<iframe id="coverddl" >

</iframe>

<div id="divMsg">

</div>

<div>

<input type="text" ID="txtTwo" runat="server" autocomplete="off" onkeydown="changeSelect()" onfocus="fnStartInterval(this,'DropDownList2')" onblur="closeSearch()" /><br />

<asp:DropDownList ID="DropDownList2" DataTextField="Slr_name" DataValueField="Systemloginrecord_id" runat="server" DataSourceID="ObjectDataSource1">

</asp:DropDownList>

</div>

</form>

</body>

</html>

【asp.net 页面版文本框智能提示JSCode (升级版)】相关文章:

asp.net页面防止重复提交示例

asp.net显示页面执行时间

asp.net刷新本页面的六种方法

asp.net OleDbCommand 的用法

asp.net 参数不同共用一个页面的实现方法

Asp.net 字符串操作基类(安全,替换,分解等)

asp.net 两个不同页面的传值

asp.net使用jquery实现搜索框默认提示功能

asp.net WebForm页面间传值方法

asp.net 事件与委托分析

精品推荐
分类导航