View Full Version : changing the url onchange of autosuggest textbox

10-06-2008, 10:19 AM
I have an html


function updateURL(){

var sCompanyName = document.getElementById('company').value;

document.getElementById("2005").href = '../announcementList.do?year=2005&company='+sCompanyName;
document.getElementById("2006").href = '../announcementList.do?year=2006&company='+sCompanyName;
document.getElementById("2007").href = '../announcementList.do?year=2007&company='+sCompanyName;
document.getElementById("2008").href = '../announcementList.do?year=2008&company='+sCompanyName;
document.getElementById("all").href = '../announcementList.do?year=all&company='+sCompanyName;

<table bgcolor="ded8ba" width="100%" align="center" border="0"><tr><td class="BorderBrown">
<bean:message key="Label.Company" /></td><td>
<html:text property="company" size="50" style="LabelZ" onkeyup="showHint(this.value)" onchange="updateURL();" /><table><tr><td><div id= "txtHint" align="left" class="txtHint" ></div></td></tr></table></td><td>
<html:submit property="step" >
<bean:message key="Button.Search"/>
</html:submit> </td ></tr>

<Table style="year-button-archive" width="60%" >
<td class="gold" >
<a title="year">By Year:</a>
<td class="gold">
<a id = "2008" title="2008" href="../announcementList.do?year=2008">2008 </a>&nbsp; | &nbsp;</td>
<td class="gold">
<a id = "2007"title="2007" href="../announcementList.do?year=2007">2007 </a>&nbsp; | &nbsp;
<td class="gold">
<a id = "2006" title="2006" href="../announcementList.do?year=2006">2006</a>&nbsp; | &nbsp;
<td class="gold">
<a id = "2005"title="2005" href="../announcementList.do?year=2005">2005 </a>&nbsp; | &nbsp;
</td >
<td class="gold">
<a id = "all" title="All" href="../announcementList.do?year=all">All </a>

my company text box is an auto suggest box
when i type any alphabet or word it suggests the text and it shows the values in the div tag.

on changing the value selected in the textbox i need to change the url.

my problem is when i type for example say
T in text box ,we get the list of companies in the dropdown of the textbox.
my url gets changed as we changed the text box value.but my url is taling only 'T'


i want to the url to be changed to
../announcementList.do?year=all&company=total solution

the one which i selected from the dropdown.

pls help me out in solving this

Thanks in advance

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum