HTML Standards Questions


The code that is causing the alert is "
<script type="text/javascript">
//<[CDATA[
function searchProduct(){
  var search_var = document.searchform.searchvalue.value;
  if (!isEmpty(search_var) && search_var != 'Product ID or Keyword') {
	  document.searchform.submit();
  }
}
//]]>
</script>

Open in new window


I receive these three messages...

Line 34, Column 3: character "<" is the first character of a delimiter but occurred as data
//<[CDATA[
¿
This message may appear in several cases:

You tried to include the "<" character in your page: you should escape it as "&lt;"
You used an unescaped ampersand "&": this may be valid in some contexts, but it is recommended to use "&amp;", which is always safe.
Another possibility is that you forgot to close quotes in a previous tag.
 Line 37, Column 28: character "&" is the first character of a delimiter but occurred as data
  if (!isEmpty(search_var) && search_var != 'Product ID or Keyword') {
¿
This message may appear in several cases:

You tried to include the "<" character in your page: you should escape it as "&lt;"
You used an unescaped ampersand "&": this may be valid in some contexts, but it is recommended to use "&amp;", which is always safe.
Another possibility is that you forgot to close quotes in a previous tag.
 Line 37, Column 29: character "&" is the first character of a delimiter but occurred as data
  if (!isEmpty(search_var) && search_var != 'Product ID or Keyword') {
¿
This message may appear in several cases:

You tried to include the "<" character in your page: you should escape it as "&lt;"
You used an unescaped ampersand "&": this may be valid in some contexts, but it is recommended to use "&amp;", which is always safe.
Another possibility is that you forgot to close quotes in a previous tag.
 Line 41, Column 3: marked section end not in marked section declaration
//]]>

How can I address this properly.
cstormerAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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

nap0leonCommented:
Try this:

<script type="text/javascript">
function searchProduct(){
  var search_var = document.searchform.searchvalue.value;
  if (!(isEmpty(search_var)) && !(search_var == 'Product ID or Keyword')) {
	  document.searchform.submit();
  }
}
</script>

Open in new window

0

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
nap0leonCommented:
Looking at the line numbers, the errors are coming from your CDATA tags.  even though you have the lines commented, they still are not valid.  You may be OK with just removing them rather than using the adjusted "if" statement I posted.
0
cstormerAuthor Commented:
Thanks
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
Software

From novice to tech pro — start learning today.