View Full Version : Combo box script embed in a .php doc need some help.

03-13-2009, 05:46 PM
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[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 "


function gothere(){

function showtext(){


03-14-2009, 02:23 AM
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....

03-14-2009, 03:28 AM
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.

03-16-2009, 09:30 PM
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/script2/combodescrip1.shtml

Here is where I have the test page at By Market dropdown shows some options, but the Market discription is not working, this is simply a textarea tag.

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

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>

Any other suggestions I should try again?