I understand that the text field and the dropdown menu
can't both be selected at the same time. That's my
dilemma. So what can I do?
Scott Reynen wrote:
>
> What about just changing the background color of the
input?
>
Niels Meersschaert wrote:
>
> Instead of using the text selected, you might
consider using a css change to
> provide some highlighting of the text.
>
Changing the background color has been my workaround,
but it just seemed a bit cheesy. The issue is what
color to use. On my mac, the default selection color
is light blue, but I can't assume it will be the same
for every user. Grey is the default color on my PC.
In the end, I want the text to be selected in the
normal sense, so that the text can be replaced as soon
as the user starts typing. After an option has been
selected, I reset the background color to white, bring
focus to the textfield and select it for further
editing. This works the way I want if the background
color matches selection color, but is a bit jarring if
they don't match. Any suggestions?
Joakim L wrote:
>
> Actually, you could store away the selection, and
restore it once an
> item is selected in the dropdown.
>
Sounds promising. How would I do that? Could you
provide a reference where I could read more about it?
Here's the updated sample code:
-------------------------------
<!--
<html>
<head>
<script type="text/javascript">
function selectText(id)
{
document.getElementById(id).focus();
document.getElementById(id).select();
}
function updateText(elem)
{
var animal =
elem.options[elem.selectedIndex].value;
document.getElementById('textField').value =
"The " + animal + " is on the mat";
makeWhite('textField');
selectText('textField');
}
function makeBlue(id)
{
document.getElementById(id).style.backgroundColor =
"#6aa3ff";
}
function makeWhite(id)
{
document.getElementById(id).style.backgroundColor =
"#ffffff";
}
</script>
</head>
<body>
<form>
<input size="18" type="text" id="textField"
value="The cat is on the mat" />
<select onmousedown="makeBlue('textField')"
onmouseup="updateText(this)" >
<option value="cat">cat</option>
<option value="bat">bat</option>
<option value="rat">rat</option>
</select>
</form>
</body>
</html>
-->
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Web-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/web-dev/email@hidden
This email sent to email@hidden