Jump to content

cs1h

Members
  • Posts

    207
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

cs1h's Achievements

Advanced Member

Advanced Member (4/5)

0

Reputation

  1. Hi, I am writing a script which contains several check boxes, one of which selects all of the other check boxes. When check boxes are ticked the information from their values is put into a hidden field as a list and if it is un-ticked it is removed. When the one which selects all of the other check boxes is ticked I want all there values to be added to the list. I cannot get the script to fill in the hidden field when the all check box is selected. The code is, <html> <head> <title>untitled</title> <script type="text/javascript" language="javascript"> function display(box) { // get reference to form object, and to array of same-named checkboxes var temparr = new Array(), f = box.form, boxgroup = f[box.name]; // loop through it for (var i=0; i<boxgroup.length; i++) { // add the value of any checked box to next available slot in temparr if (boxgroup[i].checked) temparr[temparr.length] = boxgroup[i].value; // run the .join() method on the array (separator = ',') and output it to field f.readout.value = temparr.join(','); } } function Check(chk) { if(document.myform.Check_ctr.checked==true){ for (i = 0; i < chk.length; i++) chk[i].checked = true ; }else{ for (i = 0; i < chk.length; i++) chk[i].checked = false ; } } </script> </head> <body onLoad="document.forms[0].reset()"> <form name="myform"> <ul> <li><label><input type="checkbox" name="Check_ctr" value="yes" onClick="Check(document.myform.group)"/></label> All Africa</li> <li><label><input type="checkbox" name="group" value="01A" onclick="display(this)" onChange="display(this)"/></label> Algeria</li><li><label><input type="checkbox" name="group" value="02A" onclick="display(this)" onChange="display(this)"/></label> Angola</li><li><label><input type="checkbox" name="group" value="03A" onclick="display(this)" onChange="display(this)"/></label> Benin</li><li><label><input type="checkbox" name="group" value="04A" onclick="display(this)" onChange="display(this)"/></label> Botswana</li><li><label><input type="checkbox" name="group" value="05A" onclick="display(this)" onChange="display(this)"/></label> Burkina_Faso</li><li><label><input type="checkbox" name="group" value="06A" onclick="display(this)" onChange="display(this)"/></label> Burundi</li><li><label><input type="checkbox" name="group" value="07A" onclick="display(this)" onChange="display(this)"/></label> Cameroon</li><li><label><input type="checkbox" name="group" value="08A" onclick="display(this)" onChange="display(this)"/></label> Canary_Islands</li><li><label><input type="checkbox" name="group" value="09A" onclick="display(this)" onChange="display(this)"/></label> Cape_Verde</li><li><label><input type="checkbox" name="group" value="10A" onclick="display(this)" onChange="display(this)"/></label> Central_African_Republic</li><li><label><input type="checkbox" name="group" value="11A" onclick="display(this)" onChange="display(this)"/></label> Chad</li><li><label><input type="checkbox" name="group" value="12A" onclick="display(this)" onChange="display(this)"/></label> Comoros</li><li><label><input type="checkbox" name="group" value="13A" onclick="display(this)" onChange="display(this)"/></label> Congo</li><li><label><input type="checkbox" name="group" value="14A" onclick="display(this)" onChange="display(this)"/></label> Democratic_Republic_of_Congo</li><li><label><input type="checkbox" name="group" value="15A" onclick="display(this)" onChange="display(this)"/></label> Djibouti</li> </ul> <br><input type="hidden" name="readout" size="20"> </form> </body> </html> Can anyone help solve this? Thanks, Cs1h
  2. Hi, I have a page with allot of check boxes on it and the user can choose as many as they want. What I want to do is make it so when a user ticks a box the box value is aadded to a hidden field and if they tick more the values are added to the same hidden field as a list (value1, value2, value3 etc.). But if the person changes their mind and un-ticks a box it is taken away from the list. Can anyone tell me how to do this or point me to a relevant tutorial. All help is much appriciated, Cs1h
  3. cs1h

    Search Forms

    Hi, Thanks for the reply. If there was multiple words put forward by the user would I have to split the words some how and then search them individually or will sql do this for me? Thanks, Cs1h
  4. Hi , I having been trying to create a keyword search form using php and mysql but have had little luck doing what I need to do. I want the user to be able to put multiple words into a single search box and then search three columns in a table to find possible matches. Can anyone help me with this or point me towards a good tutorial? Thanks, Cs1h
  5. Hi, How do you declare an empty array? I just want to put an empty one in so that I can add information to it later using array_push. Thanks, Cs1h
  6. Would this work if there are multiple peaks and dips?
  7. The data will be read in by translating a line in the form of an image into co-ordinates, the data will probably be stored in an array. I want to find all the highs and lows on the graph, so if it was a wave it would find the peaks and dips in it.
  8. Hi, I am trying to find a way of finding the highs and lows on a graph line, the line points will be given in the form (x,y). Does anyone know a way to do this or a tutorial that will show me how to do this? Thanks, Cs1h
  9. The data is in the form of an image, with the top white and the bottom black the line where they connect has curves and lines in it (like the silhouette of a mountain).
  10. Hi, Does anyone know how to find the equation of curved and straight lines using php? Thanks, Cs1h
  11. Hi, Does anyone know how I would quickly count the number of commas in a string? (i.e. the string 1,2,3,4,5 has 4 commas) Thanks, Cs1h
  12. Hi, That's great and thanks to both of you for the quick response. Cheers, Cs1h
  13. Hi, does anyone know a simple way to split the following string. x,1,3,42,2,5,7,y,x,1,8,4,3,y,x,5,3,3,4,y,x,2,8,7,4,6,y I want to split it into sections, x and y being the start and end of each section. Can anyone suggest a simple way to do it? Thanks, Cs1h
  14. Thank you, That is excellent. Best Regards, Cs1h
  15. Hi, I was hoping to find a way so that if I had the list of numbers 1.8,3.9,45.2,35.1 it would be able to look through the longer string like this 11.1,15.2,1.5,4.8,45.3,35.6,77.1,12.2 With a variance of +/- 1 it would be able to identify that the pattern exists in the string 11.1,15.2,1.5,4.8,45.3,35.6,77.1,12.2 Thanks for the help so far, Cs1h
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.