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:

<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

2
Contributors
4
Replies
6
Views
9 Years
Discussion Span
Last Post by Mapper99
0

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>
<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>
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!

0

Here's your code...

<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 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>
0

Thanks, works like a charm! nice tip for debugging as well.

M

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.