Forum Moderators: open

Message Too Old, No Replies

Dynamic drop-down address bar?

ie. Yahoo! Mail

         

stardust_77

3:27 pm on Jan 23, 2005 (gmt 0)

10+ Year Member



Hi!

Does anybody have any idea how to write a script for a dynamic drop down address bar that Yahoo! Mail has when you click on "Compose Reply", and in the address field, let's say you type something like "s" and a drop-down list appears below the text field with a list of addresses which starts with "s", and the drop-down list shortens as you type more alphabets and it tries to find a match in the address book.

Is there any such script for download somewhere?

Thanks for reading!

adni18

11:18 pm on Jan 23, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Here you go:

<BODY>
<script type="text/javascript">
<!--
words=new Array("anymore", "repugnance", "exile", "muslin", "autophyte", "Irrevocable", "pigment", "stover", "kakapo", "boccie", "apogamy", "Nullification", "project", "unruffled", "winsome", "sealant", "linguist", "vasculum", "rental", "guerrilla", "bakeshop");
function getAdds(val,d)
{
newStr="";
for(var i=0;i<words.length;i++)
{
if(val.replace(/\W/g,"")=="")
{
for(var i=0;i<words.length;i++)
{
newStr=newStr+words[i]+"<br>";
}
}
else if(words[i].toLowerCase().substring(0,val.length)==val.toLowerCase())
{
newStr=newStr+words[i]+"<br>";
}
}
d.innerHTML=newStr;
if(newStr.split("<br>").length==2)
{
alert("There is one match for your query: "+newStr.split("<br>")[0])
}
}
//-->
</script>

Type here: <input type="text" value="" onKeyUp="getAdds(this.value, document.getElementById('divisible'))"><br>
<br>
<div style="width:200px;height:500px;border:1px solid black;padding:5px" id="divisible">
<script type="text/javascript">
<!--
for(var i=0;i<words.length;i++)
{
document.write(words[i]+"<br>");
}
//-->
</script>
</div>

stardust_77

2:31 am on Jan 24, 2005 (gmt 0)

10+ Year Member



hey thanks alot! :)

now all I've got to do is to figure out HOW to incorporate it into my scripts.

thanks again! :)

stardust_77

2:31 am on Jan 24, 2005 (gmt 0)

10+ Year Member



hey thanks alot! :)

now all I've got to do is to figure out HOW to incorporate it into my scripts.

thanks again! :)