这个自动提示框为什么在ff用不了 ff->工具->错误控制台 看看错误 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <script language="javascript">var Class = { create: function() { return function() { this.initialize.apply(this, arguments); } }}Object.extend = function(destination, source) { for (var property in source) { destination[property] = source[property]; } return destination;}var PromptList = Class.create();PromptList.prototype = Object.extend(Object, { initialize: function(arrList, idText, idDiv) { this.aList = arrList.sort(this.SetSort); this.oText = document.getElementById(idText); this.oDiv = document.getElementById(idDiv); var oList = this; this.oText.onblur = function(){ PromptList.prototype.Hide.call(oList) }; this.oText.onkeyup = function(e){ PromptList.prototype.Keyup.call(oList, e) }; this.oText.onfocus = function(){ PromptList.prototype.Show.call(oList) }; this.iIndex = -1; }, //隐藏Div Hide : function(){ this.oDiv.style.display = 'none'; }, //排序函数 SetSort: function(a, b){ if (a.length > b.length) return 1; else if (a.length == b.length) return a.localeCompare(b); else return -1; }, //检查Div CheckDiv: function(){ if (0 < this.oDiv.childNodes.length) { return true; } else { this.Hide(); return false;} }, //输出 Output : function(){ if(this.iIndex >= 0){ this.oText.value = this.stripTags(this.oDiv.childNodes[this.iIndex].innerHTML); } this.Hide(); }, //显示选项 Show : function(){ this.SetSelect(); if (this.CheckDiv()) { this.SetDiv(); this.oDiv.style.display = ''; } }, //设置选项 SetSelect : function(){ var sValue = this.oText.value; this.iIndex = -1; this.oDiv.innerHTML = ""; if (sValue){ for (var i = 0; i < this.aList.length; i++){ if(this.aList[i].toUpperCase().indexOf(sValue.toUpperCase()) >= 0) this.Add(this.aList[i].replace(sValue, "<font color=\"#FF0000\">"+sValue+"</font>")); } } }, //插入选项 Add : function(sValue){ var oNewDiv = document.createElement("div"); var oList = this; with(oNewDiv){ style.width = "100%"; onmouseover = function(e){ PromptList.prototype.mouseSelected.call(oList, e) }; //不能只改样式,会与上下选择冲突 onmousedown = function(e){ PromptList.prototype.Click.call(oList, e) }; innerHTML = sValue; } this.oDiv.appendChild(oNewDiv); }, //显示选择项 mouseSelected : function(e){ var maxIndex = this.oDiv.childNodes.length - 1; var oSelected = (document.all) ? window.event.srcElement : e.target; if (oSelected.tagName != "DIV") oSelected = oSelected.parentNode; //由于加入了font所以要判断 for (var i = 0; i <= maxIndex; i++){ //this.oDiv.childNodes[i].className = ""; this.oDiv.childNodes[i].className = (this.oDiv.childNodes[i]==oSelected) ? "selectedStyle" : "" ; //oSelected.className = "selectedStyle"; } //this.oDiv.childNodes[this.iIndex].className = "selectedStyle"; }, //鼠标选择 Click : function (e){ var maxIndex = this.oDiv.childNodes.length - 1; var oSelected = (document.all) ? window.event.srcElement : e.target; if (oSelected.tagName != "DIV") oSelected = oSelected.parentElement; for (var i = 0; i <= maxIndex; i++) if(this.oDiv.childNodes[i] == oSelected) { this.iIndex = i; break; } this.Output(); }, //检查按键 Keyup : function(e){ var keyCode = (document.all) ? window.event.keyCode : e.keyCode; if (keyCode == 40 || keyCode == 38){ //下上 var isUp = (keyCode == 40) ? true : false; if (this.CheckDiv()) { this.Move(isUp); } }else if (keyCode == 13){ this.Output();//回车 this.SetSelect(); }else{ this.Show() } }, //上下键选择 Move : function(isUp){ if (this.oDiv.style.display == 'none'){ this.oDiv.style.display = ''; this.iIndex = 0; this.Selected(); }else{ var maxIndex = this.oDiv.childNodes.length - 1; if (isUp) { this.iIndex++; if (this.iIndex > maxIndex) { this.iIndex = maxIndex; return; } } else { this.iIndex--; if (this.iIndex < 0) { this.iIndex = -1; this.Hide(); return; } } this.Selected(); } }, //显示选择项 Selected : function(e){ var maxIndex = this.oDiv.childNodes.length - 1; for (var i = 0; i <= maxIndex; i++) this.oDiv.childNodes[i].className = ""; this.oDiv.childNodes[this.iIndex].className = "selectedStyle"; }, //设置Div SetDiv : function (){ this.oDiv.style.top = this.Top(); this.oDiv.style.left = this.Left(); this.oDiv.style.width = this.oText.offsetWidth; }, Left : function(){ var oLay = this.oText; var iLeft = oLay.offsetLeft; while( oLay != null && oLay.offsetParent != null && oLay.offsetParent.tagName != "BODY" ){ oLay = oLay.offsetParent; iLeft += oLay.offsetLeft; } return iLeft ; }, Top : function(){ var oLay = this.oText; var iTop = oLay.offsetHeight + oLay.offsetTop; while( oLay != null && oLay.offsetParent != null && oLay.offsetParent.tagName != "BODY" ){ oLay = oLay.offsetParent; iTop += oLay.offsetTop; } return iTop ; }, //去除标签 stripTags: function(sValue) { return sValue.replace(/<\/?[^>]+>/gi, ''); }});</script><body><table align="center" width="200" border="1"><tr><td><input type="text" id="inputer"></td></tr></table></body><style>.selectedStyle{background-Color:#102681;color:#FFFFFF}</style><div id='DivList' style='position:absolute;display:none;background:#E8F7EB;border: 1px solid #CCCCCC;font-size:14px;cursor: pointer;'> </div><div id="dd"> </div><script>var arrList = new Array();var intIndex=0;arrList[intIndex++] = "1sdfsdf.m";arrList[intIndex++] = "111sdafs.net";arrList[intIndex++] = "b22d1df";arrList[intIndex++] = "c333a1111sa";new PromptList(arrList,"inputer", "DivList");</script> <!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> <script language="javascript">var Class = { create: function() { return function() { this.initialize.apply(this, arguments); } }}String.prototype.matchOf = function(sValue){ return (this.toUpperCase().indexOf(sValue.toUpperCase()) >= 0);}var PromptList = Class.create();PromptList.prototype = { initialize: function(arrList, idText, idDiv) { this.aList = arrList.sort(this.SetSort); this.oText = document.getElementById(idText); this.oDiv = document.getElementById(idDiv); var oList = this; this.oText.onblur = function(){ PromptList.prototype.Hide.call(oList) }; this.oText.onkeyup = function(e){ PromptList.prototype.Keyup.call(oList, e) }; this.oText.onkeydown = function(e){ PromptList.prototype.Keydown.call(oList, e) }; this.oText.onfocus = function(){ PromptList.prototype.Show.call(oList) }; this.iIndex = -1; this.Emptyshow = false; this.rList = new Array();//存放结果 }, //隐藏Div Hide: function(){ this.oDiv.style.display = 'none'; }, //排序函数 SetSort: function(a, b){ if (a.length > b.length) return 1; else if (a.length == b.length) return a.localeCompare(b); else return -1; }, //检查Div CheckDiv: function(){ if (0 < this.oDiv.childNodes.length) { return true; } else { this.Hide(); return false;} }, //输出 Output: function(){ this.oText.value = this.rList[this.iIndex]; this.Hide(); }, //显示选项 Show: function(){ this.SetSelect(); if (this.CheckDiv()) { this.SetDiv(); this.oDiv.style.display = ''; } }, //设置选项 SetSelect: function(){ var sValue = this.oText.value; this.iIndex = -1; this.oDiv.innerHTML = ""; this.rList.length = 0; if (sValue || this.Emptyshow){ for (var i = 0, len = this.aList.length; i < len; i++){ if(this.aList[i].matchOf(sValue)) this.Add(this.aList[i], sValue); } } }, //插入选项 Add: function(rValue, sValue){ var oNewDiv = document.createElement("div"); var oList = this; with(oNewDiv){ style.width = "100%"; onmouseover = function(e){ PromptList.prototype.mouseSelected.call(oList, e) }; //不能只改样式,会与上下选择冲突 onmousedown = function(){ PromptList.prototype.Output.call(oList) }; innerHTML = rValue.replace(sValue, "<b>"+sValue+"</b>"); } this.oDiv.appendChild(oNewDiv); this.rList.push(rValue); }, //鼠标选择 mouseSelected: function(e){ var oSelected = (document.all) ? window.event.srcElement : e.target; if (oSelected.tagName != "DIV") oSelected = oSelected.parentNode; //由于加入了font所以要判断 for (var i = 0, mIndex = this.oDiv.childNodes.length - 1; i <= mIndex; i++){ if(this.oDiv.childNodes[i] == oSelected){ this.oDiv.childNodes[i].className = "selectedStyle"; this.iIndex = i;//为了和上下键互动设置 } else { this.oDiv.childNodes[i].className = ""; } } }, //检查按键 Keyup: function(e){ var keyCode = (document.all) ? window.event.keyCode : e.keyCode; if (keyCode != 40 && keyCode != 38 && keyCode != 13) this.Show(); }, //检查按键 Keydown: function(e){ var keyCode = (document.all) ? window.event.keyCode : e.keyCode; if (keyCode == 40 || keyCode == 38){ //下上 if (this.CheckDiv()) { var mIndex = this.oDiv.childNodes.length - 1; if (this.oDiv.style.display == 'none'){ this.oDiv.style.display = ''; this.iIndex = 0; }else{ if (keyCode == 40) { if (this.iIndex == mIndex) return; this.iIndex++; } else { if (this.iIndex == 0) return; this.iIndex--; } } for (var i = 0; i <= mIndex; i++) this.oDiv.childNodes[i].className = (i == this.iIndex) ? "selectedStyle" : ""; } }else if (keyCode == 13) { this.Output(); this.SetSelect(); }//回车 }, //设置Div SetDiv: function (){ var oLay = this.oText; var iLeft = oLay.offsetLeft; var iTop = oLay.offsetHeight + oLay.offsetTop; while( oLay != null && oLay.offsetParent != null && oLay.offsetParent.tagName != "HTML" ){ oLay = oLay.offsetParent; iLeft += oLay.offsetLeft; iTop += oLay.offsetTop; } this.oDiv.style.top = iTop; this.oDiv.style.left = iLeft; this.oDiv.style.width = this.oText.offsetWidth; }};</script><style>.selectedStyle{background-Color:#102681;color:#FFFFFF}</style></head><body><div id='DivList' style='position:absolute;display:none;background:#E8F7EB;border: 1px solid #CCCCCC;font-size:14px;cursor: pointer;'> </div><table align="center" width="200" border="1"><tr><td><input type="text" id="inputer"/></td></tr></table><div id="dd"> </div><script>var arrList = new Array();var intIndex=0;arrList[intIndex++] = "1sdfsdf.m";arrList[intIndex++] = "111sdafs.net";arrList[intIndex++] = "b22d1df";arrList[intIndex++] = "c333a1111sa";new PromptList(arrList,"inputer", "DivList");</script></body></html>在ff下定位还是不行怎么搞啊 用js 如何获取第二次出现反斜杠的位置 JSON对象赋值问题 Object doesn't support this property or method 请问,关于onmouseout关联的问题 联动菜单问题! css 属性~ extjs 都是谁在用 找GG 有NS的朋友请帮忙测试一下我的代码,看是否只是我的NS有问题才是这样?熟悉NS的希望也能帮忙看看! 如何设置窗口的大小 ? 这样的正则表达式能帮我拆开来说明吗? 为什么没有出现水平滚动条呢?
var Class = {
create: function() {
return function() {
this.initialize.apply(this, arguments);
}
}
}Object.extend = function(destination, source) {
for (var property in source) {
destination[property] = source[property];
}
return destination;
}var PromptList = Class.create();
PromptList.prototype = Object.extend(Object, {
initialize: function(arrList, idText, idDiv) {
this.aList = arrList.sort(this.SetSort);
this.oText = document.getElementById(idText);
this.oDiv = document.getElementById(idDiv);
var oList = this;
this.oText.onblur = function(){ PromptList.prototype.Hide.call(oList) };
this.oText.onkeyup = function(e){ PromptList.prototype.Keyup.call(oList, e) };
this.oText.onfocus = function(){ PromptList.prototype.Show.call(oList) };
this.iIndex = -1;
},
//隐藏Div
Hide : function(){
this.oDiv.style.display = 'none';
},
//排序函数
SetSort: function(a, b){
if (a.length > b.length) return 1;
else if (a.length == b.length) return a.localeCompare(b);
else return -1;
},
//检查Div
CheckDiv: function(){
if (0 < this.oDiv.childNodes.length) { return true; } else { this.Hide(); return false;}
},
//输出
Output : function(){
if(this.iIndex >= 0){
this.oText.value = this.stripTags(this.oDiv.childNodes[this.iIndex].innerHTML);
}
this.Hide();
},
//显示选项
Show : function(){
this.SetSelect();
if (this.CheckDiv()) { this.SetDiv(); this.oDiv.style.display = ''; }
},
//设置选项
SetSelect : function(){
var sValue = this.oText.value;
this.iIndex = -1;
this.oDiv.innerHTML = "";
if (sValue){
for (var i = 0; i < this.aList.length; i++){
if(this.aList[i].toUpperCase().indexOf(sValue.toUpperCase()) >= 0)
this.Add(this.aList[i].replace(sValue, "<font color=\"#FF0000\">"+sValue+"</font>"));
}
}
},
//插入选项
Add : function(sValue){
var oNewDiv = document.createElement("div");
var oList = this;
with(oNewDiv){
style.width = "100%";
onmouseover = function(e){ PromptList.prototype.mouseSelected.call(oList, e) };
//不能只改样式,会与上下选择冲突
onmousedown = function(e){ PromptList.prototype.Click.call(oList, e) };
innerHTML = sValue;
}
this.oDiv.appendChild(oNewDiv);
},
//显示选择项
mouseSelected : function(e){
var maxIndex = this.oDiv.childNodes.length - 1;
var oSelected = (document.all) ? window.event.srcElement : e.target;
if (oSelected.tagName != "DIV") oSelected = oSelected.parentNode;
//由于加入了font所以要判断
for (var i = 0; i <= maxIndex; i++){
//this.oDiv.childNodes[i].className = "";
this.oDiv.childNodes[i].className = (this.oDiv.childNodes[i]==oSelected) ? "selectedStyle" : "" ;
//oSelected.className = "selectedStyle";
} //this.oDiv.childNodes[this.iIndex].className = "selectedStyle";
},
//鼠标选择
Click : function (e){
var maxIndex = this.oDiv.childNodes.length - 1;
var oSelected = (document.all) ? window.event.srcElement : e.target;
if (oSelected.tagName != "DIV") oSelected = oSelected.parentElement;
for (var i = 0; i <= maxIndex; i++)
if(this.oDiv.childNodes[i] == oSelected) { this.iIndex = i; break; }
this.Output();
},
//检查按键
Keyup : function(e){
var keyCode = (document.all) ? window.event.keyCode : e.keyCode;
if (keyCode == 40 || keyCode == 38){ //下上
var isUp = (keyCode == 40) ? true : false;
if (this.CheckDiv()) { this.Move(isUp); }
}else if (keyCode == 13){
this.Output();//回车
this.SetSelect();
}else{ this.Show() }
},
//上下键选择
Move : function(isUp){
if (this.oDiv.style.display == 'none'){
this.oDiv.style.display = '';
this.iIndex = 0;
this.Selected();
}else{
var maxIndex = this.oDiv.childNodes.length - 1;
if (isUp) {
this.iIndex++;
if (this.iIndex > maxIndex) { this.iIndex = maxIndex; return; }
} else {
this.iIndex--;
if (this.iIndex < 0) { this.iIndex = -1; this.Hide(); return; }
}
this.Selected();
}
},
//显示选择项
Selected : function(e){
var maxIndex = this.oDiv.childNodes.length - 1;
for (var i = 0; i <= maxIndex; i++)
this.oDiv.childNodes[i].className = "";
this.oDiv.childNodes[this.iIndex].className = "selectedStyle";
},
//设置Div
SetDiv : function (){
this.oDiv.style.top = this.Top();
this.oDiv.style.left = this.Left();
this.oDiv.style.width = this.oText.offsetWidth;
},
Left : function(){
var oLay = this.oText;
var iLeft = oLay.offsetLeft;
while( oLay != null && oLay.offsetParent != null && oLay.offsetParent.tagName != "BODY" ){
oLay = oLay.offsetParent;
iLeft += oLay.offsetLeft;
}
return iLeft ;
},
Top : function(){
var oLay = this.oText;
var iTop = oLay.offsetHeight + oLay.offsetTop;
while( oLay != null && oLay.offsetParent != null && oLay.offsetParent.tagName != "BODY" ){
oLay = oLay.offsetParent;
iTop += oLay.offsetTop;
}
return iTop ;
},
//去除标签
stripTags: function(sValue) {
return sValue.replace(/<\/?[^>]+>/gi, '');
}
});
</script><body>
<table align="center" width="200" border="1">
<tr><td>
<input type="text" id="inputer">
</td></tr>
</table></body>
<style>
.selectedStyle{background-Color:#102681;color:#FFFFFF}
</style>
<div id='DivList' style='position:absolute;display:none;background:#E8F7EB;border: 1px solid #CCCCCC;font-size:14px;cursor: pointer;'> </div><div id="dd"> </div>
<script>
var arrList = new Array();
var intIndex=0;
arrList[intIndex++] = "1sdfsdf.m";
arrList[intIndex++] = "111sdafs.net";
arrList[intIndex++] = "b22d1df";
arrList[intIndex++] = "c333a1111sa";
new PromptList(arrList,"inputer", "DivList");
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script language="javascript">
var Class = {
create: function() {
return function() {
this.initialize.apply(this, arguments);
}
}
}String.prototype.matchOf = function(sValue){
return (this.toUpperCase().indexOf(sValue.toUpperCase()) >= 0);
}var PromptList = Class.create();
PromptList.prototype = {
initialize: function(arrList, idText, idDiv) {
this.aList = arrList.sort(this.SetSort);
this.oText = document.getElementById(idText);
this.oDiv = document.getElementById(idDiv);
var oList = this;
this.oText.onblur = function(){ PromptList.prototype.Hide.call(oList) };
this.oText.onkeyup = function(e){ PromptList.prototype.Keyup.call(oList, e) };
this.oText.onkeydown = function(e){ PromptList.prototype.Keydown.call(oList, e) };
this.oText.onfocus = function(){ PromptList.prototype.Show.call(oList) };
this.iIndex = -1;
this.Emptyshow = false;
this.rList = new Array();//存放结果
},
//隐藏Div
Hide: function(){
this.oDiv.style.display = 'none';
},
//排序函数
SetSort: function(a, b){
if (a.length > b.length) return 1;
else if (a.length == b.length) return a.localeCompare(b);
else return -1;
},
//检查Div
CheckDiv: function(){
if (0 < this.oDiv.childNodes.length) { return true; } else { this.Hide(); return false;}
},
//输出
Output: function(){
this.oText.value = this.rList[this.iIndex];
this.Hide();
},
//显示选项
Show: function(){
this.SetSelect();
if (this.CheckDiv()) { this.SetDiv(); this.oDiv.style.display = ''; }
},
//设置选项
SetSelect: function(){
var sValue = this.oText.value;
this.iIndex = -1;
this.oDiv.innerHTML = "";
this.rList.length = 0;
if (sValue || this.Emptyshow){
for (var i = 0, len = this.aList.length; i < len; i++){
if(this.aList[i].matchOf(sValue)) this.Add(this.aList[i], sValue);
}
}
},
//插入选项
Add: function(rValue, sValue){
var oNewDiv = document.createElement("div");
var oList = this;
with(oNewDiv){
style.width = "100%";
onmouseover = function(e){ PromptList.prototype.mouseSelected.call(oList, e) };
//不能只改样式,会与上下选择冲突
onmousedown = function(){ PromptList.prototype.Output.call(oList) };
innerHTML = rValue.replace(sValue, "<b>"+sValue+"</b>");
}
this.oDiv.appendChild(oNewDiv);
this.rList.push(rValue);
},
//鼠标选择
mouseSelected: function(e){
var oSelected = (document.all) ? window.event.srcElement : e.target;
if (oSelected.tagName != "DIV") oSelected = oSelected.parentNode;
//由于加入了font所以要判断
for (var i = 0, mIndex = this.oDiv.childNodes.length - 1; i <= mIndex; i++){
if(this.oDiv.childNodes[i] == oSelected){
this.oDiv.childNodes[i].className = "selectedStyle";
this.iIndex = i;//为了和上下键互动设置
} else { this.oDiv.childNodes[i].className = ""; }
}
},
//检查按键
Keyup: function(e){
var keyCode = (document.all) ? window.event.keyCode : e.keyCode;
if (keyCode != 40 && keyCode != 38 && keyCode != 13) this.Show();
},
//检查按键
Keydown: function(e){
var keyCode = (document.all) ? window.event.keyCode : e.keyCode;
if (keyCode == 40 || keyCode == 38){ //下上
if (this.CheckDiv()) {
var mIndex = this.oDiv.childNodes.length - 1;
if (this.oDiv.style.display == 'none'){
this.oDiv.style.display = '';
this.iIndex = 0;
}else{
if (keyCode == 40) {
if (this.iIndex == mIndex) return;
this.iIndex++;
} else {
if (this.iIndex == 0) return;
this.iIndex--;
}
}
for (var i = 0; i <= mIndex; i++)
this.oDiv.childNodes[i].className = (i == this.iIndex) ? "selectedStyle" : "";
}
}else if (keyCode == 13) { this.Output(); this.SetSelect(); }//回车
},
//设置Div
SetDiv: function (){
var oLay = this.oText;
var iLeft = oLay.offsetLeft;
var iTop = oLay.offsetHeight + oLay.offsetTop;
while( oLay != null && oLay.offsetParent != null && oLay.offsetParent.tagName != "HTML" ){
oLay = oLay.offsetParent;
iLeft += oLay.offsetLeft;
iTop += oLay.offsetTop;
}
this.oDiv.style.top = iTop;
this.oDiv.style.left = iLeft;
this.oDiv.style.width = this.oText.offsetWidth;
}
};
</script>
<style>
.selectedStyle{background-Color:#102681;color:#FFFFFF}
</style>
</head>
<body>
<div id='DivList' style='position:absolute;display:none;background:#E8F7EB;border: 1px solid #CCCCCC;font-size:14px;cursor: pointer;'> </div><table align="center" width="200" border="1">
<tr><td>
<input type="text" id="inputer"/>
</td></tr>
</table>
<div id="dd"> </div>
<script>
var arrList = new Array();
var intIndex=0;
arrList[intIndex++] = "1sdfsdf.m";
arrList[intIndex++] = "111sdafs.net";
arrList[intIndex++] = "b22d1df";
arrList[intIndex++] = "c333a1111sa";
new PromptList(arrList,"inputer", "DivList");
</script>
</body>
</html>在ff下定位还是不行
怎么搞啊