I have a problem...

Results 1 to 2 of 2

Thread: I have a problem...

  1. #1
    Join Date
    Dec 1969

    Default I have a problem...

    My script occasionally (which is the frustrating part) causes the browser hourglass to remain after the script runs. Although the hourglass is present next to the cursor I can still navigate through the site normally, including calling that function again! I don&#039;t know if it&#039;s a problem with my script or a problem with my desktop. I am calling the function from a anchor tag, the radio buttons are named Avariable_Bvariable_Cvariable where variable is a number... here is the function, any help would be greatly apprectiated!<BR><BR>// clear a set of radio buttons<BR>function clear(x,y,z) {<BR> for(var i = 1; i &#060;= z; i++) {<BR> var tmpquestion = eval("window.document.thisform.A" + x + "_B" + y + "_C" + i)<BR> if (tmpquestion.length) { <BR> for (var b = 0; b &#060; (tmpquestion.length); b++) {<BR> if (tmpquestion[b].checked) {<BR> tmpquestion[b].checked = false;<BR> }<BR> }<BR> }<BR> }<BR>}

  2. #2
    Join Date
    Dec 1969

    Default well, the eval() is uneccessary and inefficient

    try referencing like this<BR><BR>document.forms[&#039;thisform&#039;].elements[&#039;blah&#039;+x+&#039;blah&#039;].value<BR><BR>but really a nested loop like this is going to gobble resources, and you may well end up with the hourglass.<BR><BR>there&#039;s an article on the evil of eval() at http://www.infinitemonkeys.ws/ if you&#039;re interested in finding out more.<BR><BR>j<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts