Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Apr 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

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

    Hello everyone, Sorry about the subject line it should say "Combo"

    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>
    Last edited by ottster35; 03-13-2009 at 06:10 PM.

  • #2
    Regular Coder sea4me's Avatar
    Join Date
    Jan 2009
    Location
    Damn, I don't know...
    Posts
    390
    Thanks
    11
    Thanked 28 Times in 27 Posts
    PHP can't conflict with Javascript because PHP is server side and Javascript is Client side....

    You should put a bit more code so we can see what the problems are....

    other than that, you should post this in the Javascript forum....

  • #3
    Senior Coder
    Join Date
    Apr 2007
    Location
    Quakertown PA USA
    Posts
    1,028
    Thanks
    1
    Thanked 125 Times in 123 Posts
    Also, it would probably be helpful to define "bombed out". Are you getting a blank page? Is there output but not how you expect? The more descriptive you are the better people can help you.

    If possible, a link is often helpful too.
    John

  • #4
    New to the CF scene
    Join Date
    Apr 2008
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you for the responses!, what I meant by "bombed out" is just simply blank screen. I know that the function gothere() will not be use since simply to allow the go button to goto an URL. I went ahead and eliminate that function (correct me if I'm wrong). Now I'm just focusing on the showtext() function, it still would not server up the page (will not work) unless it's removed completely from the script. Then once removed it will run, of course the script won't work.

    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>
    After 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?
    Last edited by ottster35; 03-16-2009 at 09:35 PM.


  •  

    Tags for this Thread

    Posting Permissions

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