高分修改一段脚本,谢谢
一个页面,上面有4个TextBox。在TextBox1中使用了AJAX自动完成。
代码如下:
WEB CODE
___________________________________________________
<title> 无标题页 </title>
<script language= "javascript " type= "text/javascript " src= "lookup.js "> </script>
<script language= "jscript " type = "text/javascript ">
mainLoop = function()
{
val = escape(queryField.value);
if (lastVal != val)
{
var response =_Default.GetSearchItems(val);
showQueryDiv(response.value);
lastVal = val;
}
setTimeout( 'mainLoop() ', 100);
return true;
}
</script>
</head>
<body onload= "javascript:InitQueryCode( 'TextBox1 ') ">
_________________________________________________________________________
lookup.js Code
_________________________________________________________________________
//// JScript File
var DIV_BG_COLOR = "#FFFFFF ";
var DIV_HIGHLIGHT_COLOR = "#6699FF ";
var DIV_FONT = "Arial ";
var DIV_PADDING = "2px ";
var DIV_BORDER = "1px solid #CCC ";
var queryField;
var divName;
var ifName;
var lastVal = " ";
var val = " ";
var globalDiv;
var divFormatted = false;
function InitQueryCode( queryFieldName, hiddenDivName )
{
queryField = document.getElementById( queryFieldName );
queryField.onblur = hideDiv;
queryField.onkeydown = keypressHandler;
queryField.autocomplete = "off ";
if( hiddenDivName )
{
divName = hiddenDivName;
}
else
{
divName = "querydiv ";
}
ifName = "queryiframe ";
setTimeout( "mainLoop() ",100);
}
function getDiv(divID)
{
if(!globalDiv)
{
if(!document.getElementById(divID))
{
var newNode = document.createElement( "div ");
newNode.setA