•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the HTML and CSS section within the Web Development category of DaniWeb, a massive community of 425,777 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,345 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our HTML and CSS advertiser: Lunarpages Web Hosting
Views: 1131 | Replies: 4 | Solved
![]() |
•
•
Join Date: Apr 2008
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
For some reason when I click on my simple input box, the input box does not accept focus. Has anyone seen this before? Here is a link to the webpage:
www laudontech com / garmin
Here is my code:
Thanks in advance,
Mapper
www laudontech com / garmin
Here is my code:
html Syntax (Toggle Plain Text)
<form name="form1" method="POST" action="test5.php5"> </br> <P ALIGN=CENTER> <INPUT TYPE = "TEXT" VALUE ="Enter a search term" NAME="SearchItem" ID="SearchItem" onfocus="clearDefault(this)" onclick="set_focus()" > <INPUT TYPE = "Submit" Name = "Submit1" VALUE = "Find">
Thanks in advance,
Mapper
Last edited by peter_budo : Jun 8th, 2008 at 5:55 am. Reason: Keep It Organized - please use [code] tags
•
•
Join Date: Sep 2006
Location: San Diego, CA USA
Posts: 99
Reputation:
Rep Power: 3
Solved Threads: 2
Are you trying to clear the text box when it gets focus? if so, the see the code below. (I'm not too sure what you wanted to get out of the
onclick event.) html Syntax (Toggle Plain Text)
<html> <title>test</title> <script type="text/javascript"> <!-- function clearDefault(arg) { //alert("Test"); arg.value=""; } // --> </script> </head> <body> <form name="form1" method="POST" action="#"> <input type="text" value="Enter a search term" name="SearchItem" id="SearchItem" onfocus="clearDefault(this)" /> <input type="Submit" Name = "Submit1" value="Find" /> </form> </body> </html>
-Mike
•
•
Join Date: Apr 2008
Posts: 4
Reputation:
Rep Power: 0
Solved Threads: 0
Thanks for the reply Mike. All I am trying to do is get the input box to start editing if I place my cursor in it. The only way I can enter data into the box is to use tab to highlight it first. If I click in the input box when there is text in it, I can edit. When the inputbox has no text, I can't make it editable by clicking in it. Hope I haven't confused the heck out of you. Try the webpage and observe the strange behaviour.
Thanks!
Thanks!
•
•
Join Date: Sep 2006
Location: San Diego, CA USA
Posts: 99
Reputation:
Rep Power: 3
Solved Threads: 2
Here's your code...
Your <div id="A" ...> tag is interfering with your text box. i.e., it overlaps the text box.
To see what I mean, try coloring the background of the div tag with a color other than black.
Here's what I did to expose the problem...
You can probably fix this by changing your code to something like this...
or even getting rid of the div, font and center tag and doing something like this...
Hope this helps. Here's the final code.... (up to the closing </form> tag)
html Syntax (Toggle Plain Text)
<body bgcolor="#000000" onload="load()" onunload="GUnload()"> <div id="" align="center"> <a href="http://www.laudontech.com"><img alt="logo" src="http://www.laudontech.com/Images/LaudontechLogoSmall.png" border="0"></a> </div> <div id="A" style="width: 640; position: absolute; left: 50%; margin-left: -300px;" > <h3><font color="#FF8080" face="trebuchet ms" ><center>Garmin Office Plans via Google Maps</center></h3> </font> </br> </div> <form name="form1" method="POST" action="test5.php5"> </br> <P ALIGN=CENTER> <INPUT TYPE = "TEXT" VALUE ="" NAME="SearchItem" ID="SearchItem"> <INPUT TYPE = "Submit" Name = "Submit1" VALUE = "Find"> <br> </P> </form>
Your <div id="A" ...> tag is interfering with your text box. i.e., it overlaps the text box.
To see what I mean, try coloring the background of the div tag with a color other than black.
Here's what I did to expose the problem...
<div id="A" style="background-color: silver; width: 640; position: absolute; left: 50%; margin-left: -300px;" >
You can probably fix this by changing your code to something like this...
<div id="A" align="center" style="background-color: silver;>
or even getting rid of the div, font and center tag and doing something like this...
<h3 style="color: #FF8080; font-face: trebuchet ms; text-align: center;">Garmin Office Plans via Google Maps</h3>
Hope this helps. Here's the final code.... (up to the closing </form> tag)
html Syntax (Toggle Plain Text)
<html xml:lang="en" lang="en"> <head> <title>Test</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> </head> <body bgcolor="#000000" onload="load()" onunload="GUnload()"> <div id="" align="center"> <a href="http://www.laudontech.com"><img alt="logo" src="http://www.laudontech.com/Images/LaudontechLogoSmall.png" border="0"></a> </div> <h3 style="color: #FF8080; font-face: trebuchet ms; text-align: center;">Garmin Office Plans via Google Maps</h3> <form name="form1" method="POST" action="test5.php5"> </br> <P ALIGN=CENTER> <INPUT TYPE = "TEXT" VALUE ="" NAME="SearchItem" ID="SearchItem"> <INPUT TYPE = "Submit" Name = "Submit1" VALUE = "Find"> <br> </P> </form>
-Mike
![]() |
•
•
•
•
•
•
•
•
DaniWeb HTML and CSS Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Other Threads in the HTML and CSS Forum
- Previous Thread: creating a search bar for sites that don't provide one.
- Next Thread: Scrollboxes w/o tables using CSS


Linear Mode