Re: Reference input without ID
- From: "McKirahan" <News@xxxxxxxxxxxxx>
- Date: Wed, 30 Aug 2006 21:49:31 -0500
<PRESENT321@xxxxxxxxx> wrote in message
news:1156990328.241043.191140@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I have a form that appears several times on a page, and would rather
not assign IDs.
Is there a way to have my validation function focus() a text input
without IDs?
www.osbornewood.com
Search form in the upper right corner.
Don't you mean upper left side?
"http://www.osbornewood.com" has this Search Form:
<form action="http://www.osbornewood.com/search.cfm"
method="get" name="bar" id="bar" onSubmit="return searchSubmit();">
<input type="text" name="criteria" id=criteria size="7" value="Search"
style="color:grey;" onfocus="criteriaFocus(this);"
onblur="criteriaBlur(this);" />
<input type="submit" value="Go" />
</form>
which calls this function in "http://www.osbornewood.com/main.js":
function searchSubmit() {
if (document.getElementById) {
criteria = document.getElementById('criteria').value;
if (criteria == '' || criteria == 'Search') {
document.getElementById('criteria').focus();
return false;
} else {
return true;
}
}
}
Try changing it to:
function searchSubmit() {
var criteria = document.bar.criteria.value;
if (criteria == '' || criteria == 'Search') {
document.bar.criteria.focus();
return false;
} else {
return true;
}
}
Also, you can remove all "id=" from within the "form".
.
- Follow-Ups:
- Re: Reference input without ID
- From: PRESENT321
- Re: Reference input without ID
- References:
- Reference input without ID
- From: PRESENT321
- Reference input without ID
- Prev by Date: Re: Reference input without ID
- Next by Date: trap of click event for firefox and IE
- Previous by thread: Re: Reference input without ID
- Next by thread: Re: Reference input without ID
- Index(es):
Relevant Pages
|