Results 1 to 3 of 3

Thread: Combo box script embed in a .php doc need some help.

  1. #1
    Join Date
    Mar 2006
    Location
    Kansas City
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Combo box script embed in a .php doc need some help.

    Hello everyone,

    I have a .php file serving on my website in it sits a JavaScript that I copy and paste from javascriptkit.com

    The only things that this script is calling is the form name which is search_form and the select tag name which is category and onload the showtext() function.

    I have been messing with this for a couple of days now since I'm neither a .pHP or javascript programmer. But I can decypher it relatively easy.

    The problem is when I run the page in the browser it totally bombed with the current script below.

    So, I started to do a trial and error run and removed functions, what I found out was if I removed the two functions (gothere and showtext) the webpage served up just fine, but of course the script didn't work.

    Can someone take a quick peek below and see what is causing the bombed out page? I don't know if there is something between .php and JavaScript that might be of conflict with each other. Thaks in advance for looking.



    <script language="JavaScript" type="text/javascript">
    <!--

    /*
    Combo box with description credit-
    By JavaScript Kit (www.javascriptkit.com)
    Over 200+ free script here!
    */

    var shortcut=document.search_form
    var descriptions=new Array()

    //extend this list if neccessary to accomodate more selections
    descriptions[0]=""
    descriptions[1]="Specializing in applications such as heating, air conditioning, pressure boosting, and wastewater systems."
    descriptions[2]="Specializing in applications in boiler feed, clean in place (CIP), clean and wash, pressure boosting, machine tool, chemical feed, water treatment, wastewater and HVAC."
    descriptions[3]="Specializing in applications such residential and light commercial hot water circulation, heating systems,cooling and air conditioning, and sewage and effluent."
    descriptions[4]="Specializing in applications such as domestic water supply, pressure boosting, irrigation, de-watering and submersible "


    shortcut.text.value=descriptions[shortcut.category.selectedIndex]

    function gothere(){
    location=shortcut.category.options[shortcut.category.selectedIndex].value
    }

    function showtext(){
    shortcut.text.value=descriptions[shortcut.category.selectedIndex]
    }

    //-->
    </script>

  2. #2
    Join Date
    Jun 2007
    Posts
    543
    Thanks
    3
    Thanked 78 Times in 78 Posts
    Blog Entries
    1

    Default

    try
    Code:
    var shortcut=document.search_form;
    var descriptions=new Array();
    
    //extend this list if neccessary to accomodate more selections
    descriptions[0]="";
    descriptions[1]="Specializing in applications such as heating, air conditioning, pressure boosting, and wastewater systems.";
    descriptions[2]="Specializing in applications in boiler feed, clean in place (CIP), clean and wash, pressure boosting, machine tool, chemical feed, water treatment, wastewater and HVAC.";
    descriptions[3]="Specializing in applications such residential and light commercial hot water circulation, heating systems,cooling and air conditioning, and sewage and effluent.";
    descriptions[4]="Specializing in applications such as domestic water supply, pressure boosting, irrigation, de-watering and submersible ";
    
    
    shortcut.text.value=descriptions[shortcut.category.selectedIndex];
    
    function gothere(){
    window.location.href=shortcut.category.options[shortcut.category.selectedIndex].value;
    }
    
    function showtext(){
    shortcut.text.value=descriptions[shortcut.category.selectedIndex];
    }
    [Jasme Library (Javascript Motion Effects)] My Site
    /\/\@§†ê® §©®¡þ† /\/\@|{ê®
    There are 10 kinds of people in the world, those that understand binary and those that don't.

  3. #3
    Join Date
    Mar 2006
    Location
    Kansas City
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for the quick response!, I tried the code you provided below and it's not doing it. Still bombed out. I know that the function gothere() will not be use since it to alert the go button to goto the URL. I went ahead and eliminate that function. Now I'm just focustion on the showtext() function still would not server up the page unless it's removed completely from the script.

    This is where I grab the script from http://www.javascriptkit.com/script/...descrip1.shtml

    Here is where I have the test page at http://207.126.55.155/index2a.php By Market dropdown shows some options, but the Market discription is not working, this is simply a textarea tag.
    Code:
    <textarea rows=5 cols=45 wrap="virtual" name="text"></textarea>
    The minute I put in showtext() function I get white screen nothing at all. And if I were to view source on the bombed out page. I get this below...

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML><HEAD>
    <META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>
    <BODY></BODY></HTML>
    Any other suggestions I should try again?

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
  •