Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6990285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:19:40+00:00 2026-05-27T19:19:40+00:00

My script function is defined inside a JSF2 form on a XHTML page and

  • 0

My script function is defined inside a JSF2 form on a XHTML page and the following part of the code causes a problem:

<script type="text/javascript">
  function myFunction(){
   var checkboxes = document.getElementsByName('mycheckboxes');
   if(checkboxes.length > 0){
     for (var i=0; i<checkboxes.length; i++){
      var checkbox = checkboxes[i];
     }
    }
  }
</script>

When trying to access the page in FireFox 8 it prints the exception:

Element type “checkboxes.length” must be followed by either attribute specifications, “>” or “/>”

what does this error mean?

Another question: is the script is executed before the pages is rendered? Because my checkboxes is loaded in the page during render phase of page (using JSF <ui:repeat>), so my guess is that I must make a condition to execute the code when the variable checkboxes is not null, am I right?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T19:19:41+00:00Added an answer on May 27, 2026 at 7:19 pm

    It looks like you are using XHTML and embedding scripts in the page.

    XML doesn’t have intrinsic CDATA sections, so < means “start of tag” even inside a script element.

    If you were using real XHTML then you could represent it as &lt;, but then you couldn’t serve the document as text/html.

    Instead you can wrap the script content with an explicit CDATA section as described in the specification while also taking care to follow the relevant text/html compatibility guidelines.

    You would probably be better off keeping your script in an external file and loading it with <script src="..."></script>.

    For that matter, you are likely to be better off using HTML instead of writing XHTML and then jumping through hoops to make it work in browsers that expect HTML.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am referencing JavaScript as follows on an HTML page: <script type=text/javascript src=http://code.jquery.com/jquery-1.6.1.min.js></script> <script
I have following pages: popup.html <script type=text/javascript> //requires function doFunction(){ alert(hi); } </script> <button
I have some nice dialogues defined as such in jQuery: <script type=text/javascript> $(document).ready(function() {
I'm using script language ChaiScript with c++ and Qt. I've defined such function: void
For example: script.js: function functionFromScriptJS() { alert('inside functionFromScriptJS'); } iframe.html: <html> <head> <script language=Javascript
I'm writing a firefox extension and have the following problem: I added inside a
The JS script: function ShowUploadingAnimation() { $('#info_msg').html(<div style=\padding-top: 15px; height: 50px;\ align=\center\><img id=\uploading-img\ /></div>);
I need a java script function that converts the document object of the current
I have a java script function that i have called on body load mousemove()
Linux bash script: function Print() { echo $1 } Print OK This script runs

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.