469,626 Members | 1,442 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,626 developers. It's quick & easy.

set focus within a php form

17
hi,

if i have a form within a php script which looks something like

<input type=\"text\" name =\"title\" size=\"5\" maxlength=\"6\">

how can i have the cursor automatically flashing in the text box?

Please be aware that this is within php tags.

Thanks

Paul
Dec 6 '07 #1
3 8707
Markus
6,050 Expert 4TB
Can't be done with php.

It can, however, be done with javascript.
Dec 6 '07 #2
whitey
17
thats such a shame as its a really nice simple little effect.

could i embed the javascript within the php?

do you have such a script? :-)
Dec 8 '07 #3
arunj82
15
Hi,
This is the example code. you try it.
Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  2. <HTML>
  3. <HEAD>
  4. <TITLE> New Document </TITLE>
  5. <META NAME="Generator" CONTENT="EditPlus">
  6. <META NAME="Author" CONTENT="">
  7. <META NAME="Keywords" CONTENT="">
  8. <META NAME="Description" CONTENT="">
  9. <script>
  10.         function setFocus()
  11.         {
  12.                 document.frmtest.title.focus();
  13.         }
  14. </script>
  15. </HEAD>
  16. <BODY onLoad="setFocus()";>
  17. <form name="frmtest">
  18. <?
  19.     echo "<input type=\"text\" name =\"title\" size=\"5\" maxlength=\"6\">";
  20. ?>
  21. </BODY>
  22. </HTML>
Dec 8 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

8 posts views Thread by copyco | last post: by
3 posts views Thread by Brian Henry | last post: by
1 post views Thread by clickon | last post: by
3 posts views Thread by jan.loucka | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.