![]() |
|
|
|
||||||||||
![]() |
|
|
Thread Tools |
|
#1
|
|||
|
|||
|
How to type in a Form Field without clicking it - i.e like Google/Yahoo?
This may be an easy one and I used to be able to do this in old versions of DW, but how to make a field open (i.e. you can type in it straight away) without clicking on it first.
Examples - the search boxes in Yahoo/Google...you don't need to click on them before you type your search. Thanks |
|
#2
|
|||
|
|||
|
javascript
It's javascript, did you looked at google code?
you can do that: Code:
<body onload="myfunction()"> Code:
<script type="text/javascript">
<!--
function myfunction() {
this.focus()
};
// -->
</script>
|
|
#3
|
|||
|
|||
|
Ah I thought it was something I needed to add in the <input form part> thanks, I'll test it
|
|
#4
|
||||
|
||||
|
Heres what i use:
add this onload statement to your <body> tag. php Code:
below is the input field that will be recieving the focus... see how the name of it is "aname" - same as in the onload statement? php Code:
|
|
#5
|
|||
|
|||
|
thanks but didn't work for me.
|
|
#6
|
|||
|
|||
|
Well Mishoni,
I thought you had already solved this problem. But look like not. I think it didn't work cause you haven't read carefully what he said. Please note this Quote:
Give your form a name and it will work. But if you do not want to think, find te code below Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>
</title>
</head>
<body onload="document.myform.myinput.focus()">
<form name="myform">
<input name="myinput" type="text" />
<input type="button" value="GO!" />
</form>
</body>
</html>
cagintranet in fact solved your problem already. |
|
#7
|
|||
|
|||
|
Err thanks for the beginneers run thru, your rcode didn't work for me though - I've got multi-layered dynamic tabs on my site same as Google/Yahoo and it doesn't pick it up. Here's the code I've been messing with but I don't think there's a solution. No Cagintranet's code gives JS errors...
<script> <!-- function selector(){document.schina.q.focus();} d=document; // --> </script> </head> <body onLoad=selector()> |
|
#8
|
|||
|
|||
|
can you please post the site so I can have look. Or pls pm.
|
|
#9
|
|||
|
|||
|
Thanks for the offer, I've spent a couple of hours on it and realised it's not worth it at this moment...is ok thanks for the help though.
|
|
#10
|
|||
|
|||
|
focus not in Safari Mac
document.form.fieldname.focus() does not seem to work on Safari when i test it. Is anyone else having this trouble? Anyone can provide a solution please?
|
|
#11
|
|||
|
|||
|
Quote:
<body onload="document.forms.n1.n3.focus()"> <form name="n1"> <input name="n2"><input name="n3"> </form> </body> or this: <body onload="document.getElemenetById("id3").focus()"> <form> <input name="n2"><input name="n3" id="id3"> </form> </body> J.D. |
![]() |
| Bookmarks |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Preparing for Google vs. Yahoo Adsense type products. | d360 | Publisher Network | 10 | Apr 29th 2005 8:23 am |
| Does Yahoo use some form of sandboxing? | hmilesjr | Yahoo | 12 | Apr 25th 2005 12:22 am |
| How to add a background colour to an Input type in a form | misohoni | CSS | 2 | Nov 7th 2004 9:10 pm |
| How To Define Width Of Field In Form? | digitalpoint | CSS | 8 | Oct 9th 2004 1:43 am |
| Payment Type Field | directusnet | Optigold ISP | 1 | Sep 21st 2004 7:46 am |