Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Menu - Slight dotted line around element 2

Status
Not open for further replies.

Graeme06

Technical User
Jun 6, 2006
60
Hi, I'm still working on an Ajax application that involved the use of a menu item (I think it's just a combo box with multiple items or something). The problem I have is that after double clicking an item and through Javascript setting it's "selected" attribute to false, there remains a faint dotted line around an element in the list. Is there a name for this attribute and can it be turned off just like "selected" was? Thanks.
 
You need to blur the item with focus. Something like this wold probably work:
Code:
<div id="wibble" onclick="doStuff();[b]this.blur()[/b]">....</div>
Cheers,
Jeff

[tt]Jeff's Blog [!]@[/!] CodeRambler
[/tt]

Make sure your web page and css validates properly against the doctype you have chosen - before you attempt to debug a problem!

FAQ216-6094
 
Thanks, that sort of works. It fixes my problem, but creates a far worse one, the window I'm working in minimizes. I didn't use that code exactly (I'm not sure why you have it as a property of the div), but I used the this.blur() in the function that I need it to take place in, and it causes the window to minimize.
 
Don't use it in the function, use it after the function call in the element, like the example shows. If you use it in the function, this refers to the window object (I believe), not the page element you referred to.

If you want to use it in a function, you need to refer to the object you want to send the focus from, such as:
Code:
document.forms['formname'].elements['elementname'].blur();
or
Code:
document.getElementById['elementID'].blur();

Lee
 
Ah got it, that makes sense then.

Anyways, this works, looks great, thanks for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top