www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Client-Side Development > JavaScript

    JavaScript JavaScript (not Java) Discussion and technical support, including AJAX and frameworks (JQuery, MooTools, Prototype...)

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 07-08-2003, 04:59 AM
    nlight nlight is offline
    Registered User
     
    Join Date: Jan 2003
    Posts: 2
    javascript navigation pulldown menus

    hey all,

    got a quick one.. i am using a javascript pulldown menu and it works fine. The only problem is that I want the "GO" button to be a pic instead of the standard windows go button. Every time i try to change it to a picture though, the script breaks. Any suggestions, code ex's below.

    external .js file:

    function formHandler(){
    var URL = document.form.site.options[document.form.site.selectedIndex].value;
    window.location.href = URL;
    }

    document.write('<form name="form">');
    document.write('<select name="site" size=1 style="border:1px solid #000000; font-family: arial,helvetica; font-size: 11px; height: 19px; width: 140px;float:right; background-color:#767676; color:#FFFFFF">');
    document.write('<option value="">Choose Below↓');
    document.write('<option value="http://www.productsiege.com/page_promos/christian_products_promo.htm">Christian Products');
    document.write('<option value="http://www.productsiege.com/page_promos/harry_potter_promo.htm">Harry Potter');
    document.write('<option value="http://www.productsiege.com/page_promos/ipowerweb_hosting_promo.htm">iPowerWeb Hosting');
    document.write('<option value="http://www.productsiege.com/page_promos/michael_thurmonds_6_week_body_makeover_promo.htm">6 Week Body Makeover');
    document.write('</select>');
    document.write('<input type="image" src="images/index/shopping_search_go.gif" border="0" align="left" width="25" height="25" onClick="javascript:formHandler()">');
    document.write('</form>');

    Code Embedded in body of Page:

    <script language="JavaScript" src="includes/menu.js"></script>

    Everything works great right up until the point that i change the input type to an image.

    See it in action here, http://www.productsiege.com/index2.htm

    Thanks in advance for any help.
    Reply With Quote
      #2  
    Old 07-08-2003, 08:10 AM
    requestcode requestcode is offline
    Old fart
     
    Join Date: Mar 2003
    Posts: 590
    An input type of image is used for submitting forms that may be why the onClick is not working correctly. Try this:
    document.write('<a href="javascript:formHandler()"><img src="images/index/shopping_search_go.gif" border="0" align="left" width="25" height="25">');
    Reply With Quote
      #3  
    Old 07-08-2003, 09:17 AM
    freefall's Avatar
    freefall freefall is offline
    l os t...
     
    Join Date: Apr 2003
    Posts: 160
    Yeah, I think the reason you were having an error is because of the way you fire your function. If you call it on an event (like onclick), you don't need to include the "javascript:"
    That's used in href tags (like rc's solution). In an event, simply call formHandler(). Also, javascript: has no space.

    document.write('<img src="images/index/shopping_search_go.gif" border="0" align="left" width="25" height="25" onClick="formHandler()">');

    - Ian
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 04:08 PM.



    Acceptable Use Policy


    The Network for Technology Professionals

    Search:

    About Internet.com

    Legal Notices, Licensing, Permissions, Privacy Policy.
    Advertise | Newsletters | E-mail Offers

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.