jsf - Smaller operator gives error in javascript code -


i have javascript code in xhtml file. here is:

<h:head>     <h:outputstylesheet library="css" name="styles.css"  />       <script>             function datatableselectoneradio(radio) {                 var id = radio.name.substring(radio.name.lastindexof(':'));                 var el = radio.form.elements;                 (var = 0; < el.length; i++) {                     if (el[i].name.substring(el[i].name.lastindexof(':')) == id) {                         el[i].checked = false;                     }                 }                 radio.checked = true;             }         </script> </h:head> 

the problem ist, inside loop gives error "<" operator saying "the content of elements must consist of well-formed character data or markup.". think sees "<" html element i.e. "body, html etc. not sure. how can fix this?

thanks

edit: tried still error. there syntax error see?

<script>             function datatableselectoneradio(radio) {                 var id = radio.name.substring(radio.name.lastindexof(':'));                 var el = radio.form.elements;                 (var = 0; &lt; el.length; i++) {                     if (el[i].name.substring(el[i].name.lastindexof(':')) == id) {                         el[i].checked = false;                     }                 }                 radio.checked = true;             }         </script> 

the error says that:

myaccounts.xhtml:5:52 expected ) found ;                 (var = 0; &lt; el.length; i++) {                                                 ^  myaccounts.xhtml:5:57 expected ; found )                 (var = 0; &lt; el.length; i++) {                                                      ^ 

try using cdata xml parser not read javascript content, code this:

<h:head>     <h:outputstylesheet library="css" name="styles.css"  />      <script>         // <![cdata[         function datatableselectoneradio(radio) {             var id = radio.name.substring(radio.name.lastindexof(':'));             var el = radio.form.elements;             (var = 0; < el.length; i++) {                 if (el[i].name.substring(el[i].name.lastindexof(':')) == id) {                     el[i].checked = false;                 }             }             radio.checked = true;         }         // ]]>     </script> </h:head> 

Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -