0

i have placed a text box with onclick and onblur event. onclick shows contents(links) of a div tag below it and onblur hides the div
basically it was a jquery based drop down menu but due to some problem I need to avoid jquery. Now the problem happens when a link of div tag is clicked. The link does not work due to onblur event on the textbox. Any suggestion?

<input type="text" style="text-transform: capitalize;" value="" class="abd_txtfld" name="loc" id="loc" onclick="gettabcontentSearch('','')" onblur="hide()"/>
<div id="cityddsearch" class="select_citydd" style="position: absolute; margin-top: 2px; left: 5px; display: none;">
<ul>
<li><a href='../link1.asp'>link1</a></li>
<li><a href='../link2.asp'>link2</a></li>
<li><a href='../link3.asp'>link3</a></li>
</ul>
</div> 

Edited by diafol: apply code tags

2
Contributors
3
Replies
4
Views
5 Years
Discussion Span
Last Post by dips255
0

I need the javascript source code to see if the functions "gettabcontentSearch" & "hide" dont contain errors. I'm assuming they don't, then try the below code. Replace what you have got up there with that. And tell us if it works, OK?

onclick="gettabcontentSearch('','');" onblur="hide();"

Another thing to note is that does the the function gettabcontentSearch take arguments? if not, then take out the args and try it. they might be causing the errors.

0

I noticed something in your HTML code. The HREF's have asp files in them? Do they exist in the same folder?

0

The functions are as follows

function gettabcontentSearch(cityname,citycode)
{
cityobj = document.getElementById("cityddsearch");
cityobj.style.display = 'inline'
}

ntentSearch(cityname,citycode)
{
cityobj = document.getElementById("cityddsearch");
cityobj.style.display = 'inline'
}
function hide()
{
cityobj = document.getElementById("cityddsearch");
cityobj.style.display = 'none'
}

I planned to pass the variables for some reason but I can avoid it
Actually when a link from the

function hide()
{
cityobj = document.getElementById("cityddsearch");
cityobj.style.display = 'none'
}

I planned to pass 2 variables for some reason but I can avoid it
Actually when a link from the div tag is clicked, the onblur event gets fired which i believe stops the onclick event of the link

Edited by dips255

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.