Results 1 to 3 of 3

Thread: Select Radio when Text Entered

  1. #1
    Join Date
    Mar 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Select Radio when Text Entered

    I would like a radio button to be selected when I focus on the accompanying text field. Here's what I have so far, I think I just have some type of syntax problem. Can anyone help? check red area....


    Code:
    <form name="propSearch" id="propSearch" action="index3.php" method="get">
              <center>
                
    <p> 
    			<input type="hidden" name="option" value="com_wrapper">
    
    			<input type="hidden" name="Itemid" value="74">
    
    			<input name="KeyField" value="ListingID" type="radio">Search by MLS
    
                  <input name="ListingID" id="ListingID" class="small" value="Enter MLS number..." onfocus="this.value=''" onfocus="(document.propSearch.KeyField[0].value == true)"
     onload="this.value='Enter MLS #...'" size="25" maxlength="20" type="text">
                </p>
    <p> 
    			 <input name="KeyField" value="City" type="radio">
    			 Search by City 
    			<input name="City" id="City" class="small" value="Enter City..." onfocus="this.value=''" 
    onfocus="(document.propSearch.KeyField[1].value == true)" 
    onload="this.value='Enter City...'" size="25" maxlength="15" type="text"> 
                </p>
    
    
                
    <p>
                  <input name="Submit" value="Submit" type="submit">
    			
              </p>
    </center>
            </form>

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    <input name="ListingID" id="ListingID" class="small" value="Enter MLS number..." onfocus="this.value=''" onfocus="(document.propSearch.KeyField[0].value == true)"
    onload="this.value='Enter MLS #...'" size="25" maxlength="20" type="text">
    I don't think input elements have an onload event; you certainly can't specify the same event twice. Also, you're using a comparison operator instead of an assignment operator to perform an assignment.
    Code:
    <input name="ListingID" id="ListingID" class="small" value="Enter MLS number..." onfocus="this.value=''" onfocus="(;document.propSearch.KeyField[0].value =checked = true)"
     onload="this.value='Enter MLS #...'" size="25" maxlength="20" type="text">
    Remove the bits in red, add the bits in green.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Mar 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    That worked thanks!
    Last edited by abskure; 04-10-2006 at 05:06 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •