HTML / Javascript doesn't work

Please see attached.

This used to work, I made some changes, I CANNOT see what the error is.

When you change the value of the country pulldown, it should execute the specified JavaScript function.

It does not.

What?
htmlpage.htm
Richard KortsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Paul MacDonaldDirector, Information SystemsCommented:
I can't tell you why - I'm not javascript expert - but removing ALL the document. lines fixed the problem for me.

<script type="text/javascript">
      function chk_ctry() {
            alert("Entered chk_ctry");
            if (document.st.country.value == "Other" || document.st.country.value == "") {
                  alert("Please select USA or Canada");
                  return false;
            }
       }
 
 
      function chk_state() {
            if (document.st.state.value == "") {
                  alert("Please select a State");
                  return false;
            }
       }
 
   
      function chk_vals() {
            if (ac == "") {
                  if (document.st.state.value == "") {
                        alert("Please select a State");
                        return false;
                  }
             }
   
            if (ac == "C") {
                  if (document.st.cltype.value == "") {
                        alert("Please select a Cleaning Type");
                        return false;
                  }
             }      
      }
</script>
0
Julian HansenCommented:
The problem is on line 40
document.st.action = "indexp.php?country=" + document.st.country.value + "&state=" + document.st.state.value + "&cltype=" document.st.cltype.value;

Open in new window

Specifically look at the last bit you will see it is missing a concatenation (+) char
... document.st.state.value + "&cltype=" document.st.cltype.value;
                                        ^

Open in new window

Should be like this
 ... document.st.state.value + "&cltype=" + document.st.cltype.value;

Open in new window


The reason:
The missing char was generating a javascript error which stopped the function from running.
2

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Richard KortsAuthor Commented:
Yeah, that's the obvious problem.

As an aside, I use FireFox & I turned WebConsole on (it often picks up those kinds of things). Showed nothing here.
0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

Julian HansenCommented:
As an aside, I use FireFox & I turned WebConsole on (it often picks up those kinds of things). Showed nothing here.
That sometimes happens - are you using the default console or Firebug? I would recommend installing the latter.
0
Richard KortsAuthor Commented:
I'm not using Firebug because I can't figure out HOW to use it.

I've tried, seems like it's VERY complex.
0
Julian HansenCommented:
It does have many features but for the most part the console is very similar to the default console (same for the DOM viewer etc) - a necessary tool for debugging - can save hours of frustration.
0
Richard KortsAuthor Commented:
Thanks, maybe I'll try again.

But I always have EE :) !

I find about an 80% overall success rate with EE & with web development things, probably more like 95%
0
Julian HansenCommented:
But I always have EE :) !
We exist to serve ... :)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.