Jump to content

mwl707

Members
  • Posts

    44
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

mwl707's Achievements

Member

Member (2/5)

0

Reputation

  1. Hi , I have this php code $strXML .= "<chart caption='ADI Chart Test ' xAxisName='Month' yAxisName='Units' showValues='0' formatNumberScale='0' showBorder='1'>"; echo " <td align='right' onClick='drawchart($strXML)' > $totalcost </td> " ; this is passed to a javascript function function drawchart(dataX) { var chart1 = new FusionCharts("../charts/Pie3D.swf", "chart1Id", "400", "300", "0", "1"); chart1.setDataXML(dataX); chart1.render("chart1div"); My problem is that the link is not displayed correctly and more importantly there is no data when it get to the js function Could anyone tell me how to send xml data this way please ?
  2. I am trying to compare two dates , I have this code which I thought would work a treat but it didn't . For now I just want to alert an error if the enddate is less than the start date . The date style yyyy-mm-dd needs to be kept in this format for other events prior to this. can anyone give me a clue ? thanks startdate = "2009-11-01" ; enddate = "2009-11-04" ; var d1 = new Date(startdate) var d2 = new Date(enddate) if (d2 < d1) { alert ("Error ! ) ; } document.cookie='st =' + startdate // set sytem cookie document.cookie='en =' + enddate window.location = self.location.href window.opener.location.reload() close()
  3. Hi This is the generated HTML code <h2 align= 'center' > Pontefract Racecourse (Job Number 427) : Screens required : 2 </h2> <table id='visi' width='480px' align='center' cellspacing='1' cellpadding='1' border='1' > <tr> <td >i100<br> [2 to Allocate] </td> <td class='truckbox' > <div class='i100s' id='i100s1' onClick='allocate("2","i100s1")' > </div> </td> <td class='truckbox' > <div class='i100s' id='i100s2' onClick='allocate("2","i100s2")' > </div> </td> <td class='truckbox' > <div class='i100sg' id='i100s3' onClick='allocate("2","i100s3")' > </div> </td> <td class='truckbox' > <div class='i100sg' id='i100s4' onClick='allocate("2","i100s4")' > </div> </td> </tr> <td >i25<br> [1 to Allocate] </td> <td class='truckbox' > <div class='i25s' id='i25s1' onClick='allocate("1","i25s1")' > </div> </td> <td class='truckbox' > <div class='i25sg' id='i25s2' onClick='allocate("1","i25s2")' > </div> </td> </tr> <td >i12<br> [2 to Allocate] </td> <td class='truckbox' > <div class='i12sg' id='i12s1' onClick='allocate("2","i12s1")' > </div></td> <td class='truckbox' > <div class='i12s' id='i12s2' onClick='allocate("2","i12s2")' > </div> </td> <td class='truckbox' > <div class='i12s' id='i12s3' onClick='allocate("2","i12s3")' > </div> </td> <td class='truckbox' > <div class='i12sg' id='i12s4' onClick='allocate("2","i12s4")' > </div></td> </tr> </table> <table width='200px' align='center' cellspacing='12' cellpadding='1' > <tr></tr> <tr><td class='truckbox' ><div class='yesbutton' id='yes' onClick='confirm_allocate()' ; return false ; > <td class='truckbox' ><div class='nobutton' id='no' onClick='hide()' > </tr> </table> if it helps to see the box here is the link http://www.abbeysoft.co.uk/adi/diary_booking/diary_view.php From there you need to click 'listings date range and make sure the range includes 15th October 2009, then click Pontefract Racecourse in orange on this date. this will display the table.
  4. Hi I have a php script that draws a table subject to certain conditions. When the table is drawn it is inside a div called ‘window’ and the table is called ‘visi’ I then want to use the code below to get the id’s of each cell in the table. I can get the class name no problem but get absolutely nothing from the id. Can anyone give me an idea of what i am doing wrong?. I have tried a similar peice of code on a table that is not inside a div and it works fine. Any help would be great and I hope the code makes sense. function confirm_allocate() { var msg = "" var tab = document.getElementById('visi'); var r = tab.rows.length for (i=0; i<r; i++){ cc = tab.rows.cells.length for (col=0; col<cc; col++){ x=document.getElementById('visi').rows.cells; iden = x[col].className ref = x[col].id msg += "Class =" + iden + " /// Id =" + ref + "\r" } } alert (msg ) } If it helps this is the code to draw the table (but this is called using js/ ajax after getting the information for the table ) <?php $table = "" ; include '../database_sql/dbconnect.php' ; include '../functions/job_details.php'; include '../functions/check_date.php'; include '../functions/stock_list.php' ; include '../functions/allocated_on_date.php' ; $jobdate = $_GET['jobdate'] ; $jobnumber = $_GET['jobnumber'] ; $jobname = $_GET['jobname'] ; $screens = screens_per_job($jobnumber,$size) ; $table = "<h2 align= 'center' > $jobname (Job Number $jobnumber) : Screens required : $screens </h2>" ; $table .= "<table id='visi' width='480px' align='center' cellspacing='1' cellpadding='1' border='1' ><tr>" ; // get stock list from DB stock_list() ; $len = count( $stock); $evresult = mysql_query("SELECT * FROM event WHERE jobnumber = '$jobnumber' ") ; $event_row = mysql_fetch_array($evresult); for ($counter = 0; $counter < $len; $counter++) { $item = $stock[$counter] ; $items = $item . "s" ; $booked_for_job = $event_row[$items] ; $result = mysql_query("SELECT * FROM $item ") ; allocated_on_date($jobdate) ; // function if ($booked_for_job) { $count = 1 ; $table .= "<td >$item<br> [$booked_for_job to Allocate] </td> " ; WHILE ($row = mysql_fetch_array($result)) { ; $booked_job = $screens[$item][$count]["job"] ; // from the allocated_on_date($jobdate) function $description = $row['trailer_id']; $class = $items ; $id_items = $items . $count ; $count ++ ; if ($booked_job == $jobnumber) { // allocated to current job $table .= "<td class='truckbox' > <div class='$class' id='$id_items' onClick='allocate(\"$booked_for_job\",\"$id_items\")' > " ; $table .= "$num </div> </td>" ; } ELSEIF ($booked_job === 0 ) { // available to allocated $class .= "g" ; $table .= "<td class='truckbox' > <div class='$class' id='$id_items' onClick='allocate(\"$booked_for_job\",\"$id_items\")' > " ; $table .= "$num </div> </td>" ; } ELSE { // allocated to ANOTHER job $class .= "a" ; $table .= "<td class='truckbox' > <div class='$class' id='$items' > " ; $table .= "</td> " ; } } // while $table .= "</tr>" ; } ; // if }; //for $table .= "</table> " ; $table .= "<table width='200px' align='center' cellspacing='12' cellpadding='1' ><tr>" ; // draw table buttons close and allocate $table .= "</tr><tr>" ; $table .= "<td class='truckbox' <div class='yesbutton' id='yes' onClick='confirm_allocate()' ; return false ; > "; $table .= "<td class='truckbox' <div class='nobutton' id='no' onClick='hide()' > "; $table .= "</tr></table> "; echo $table ; // finally draw table include '../database_sql/dbclose.php' ; ?>
  5. Thanks for your help , it works fine ! Cheers
  6. Hi, The code below draws a 4x4 table using php. after that I use JS to get the number of rows in the table. The problem is I know there are only four rows but the 'r' value is 8. Can anyone tell me whats going wrong please ? Also I would like to get the total of columns can anyone give me a clue . Thanks <script> function check() { var tab = document.getElementById('mytable'); var r = tab.rows.length alert ® } </script> </head> <body> <?php echo "<table id='mytable' border ='1' >" ; for ($row = 1; $row<5; $row ++) { echo "<tr>" ; for ($col=1; $col<5; $col++) { echo "<td >$col $row" ; echo "</td>" ; } echo "<tr>" ; } // for ?> <label> <input type="button" id="button" value="Run JS " onclick="check()"/> </label>
  7. Thanks for the PM, This code will be a part of a function that I will call several times. Rather than writing the code many time is the reason for not defining the arrays first
  8. I am getting a list from a table in a database , Each of the items in the list need to become arrays. As the list will change I cannot declare the arrays first Mick
  9. The problem is that $people[0] has no value at all
  10. Hi I have a variable that I would like to make an array without naming the array directly . I hope this makes sense ? $count = 0 ; $text = "people" . "[$count]" ; $$text = "John" ; hopefully I want to be able to do this now echo $people[0] ; and the result should be 'John' ?? But I get nothing at all Can anyone tell me if I can do this ?? Thanks
  11. in my script I use example = xmlDocument.getElementsByTagName("days"); to retrieve a element from an XML file , What I would like to do is retrieve the information without specifying the tag names , How can I get a list of all the elements so I can run a loop to get all the info ? Thanks for any help .....
  12. mwl707

    Input box

    Hi I want to display a form pre-filled with some data. I am using javascript to do this. But after pre-filling the form i want to 'protect' one of the input boxes so the data cannot be changed. is there any way I can do this ?. I know I could remove the input box in question and just add the data in a div area etc.. but i would like to keep the continuity of the form . Any help or suggestions would be much appreciated thanks
  13. Thanks but thats not the problem
  14. Hi I have a script that validates the entries on a form. If there are errors then it alerts the user and return false. This works fine. But if there are no errors and i return TRUE nothing happens the form is not sent . the line in my PHP is this <form id='form1' name='form1' style='background-color:ccc' method='post' onsubmit='return form_val($importedjobnumber) ' action='processform.php?job=new' and this is my AJAX , Can anyone help me please its driving me mad !! // JavaScript validate form function form_val() { if(XMLHttpRequestObject) { XMLHttpRequestObject.open("GET", "form_validate.php", true); // This php script gets error messages to be displayed XMLHttpRequestObject.onreadystatechange = function() { if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) { var xmlDocument = XMLHttpRequestObject.responseXML; msg = "" elem = document.getElementById('form1').elements; leg = elem.length for (i=1; i<leg; i++) { Vname = "" Vname = elem[i].name if (Vname) { try { error_entry = xmlDocument.getElementsByTagName( Vname ); validator = xmlDocument.getElementsByTagName( "V" + Vname ); vv = validator[0].firstChild.data // <Vevent> text </Vevent> ee = error_entry[0].firstChild.data // <event> must enter a place </event> eeform = "" eeform = document.getElementById(Vname).value if (ee && eeform ) {document.getElementById(Vname).style.backgroundColor='#E1E1E1' } // return red box to grey if (ee && !eeform ) { document.getElementById(Vname).style.backgroundColor='red' msg += ee ; msg += " Validator " + vv msg += "\n\n" } //if } catch(err) { } } // if } //for if (!msg) { // THIS DOES NOT WORK alert ("returning true") return true } alert ("Please correct the following \n\n" + msg ) } } XMLHttpRequestObject.send(null); } return false ; } // end of function
×
×
  • 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.