Jump to content


  • Content Count

  • Joined

  • Last visited

Community Reputation

0 Neutral

About grippat

  • Rank
  • Birthday 12/06/1984

Contact Methods

  • Website URL
  • ICQ
  1. I have a little bit of JavaScript that's run when a user clicks on an image. This code makes the image div invisible and creates object, param, and embed tags to insert an .swf file in it's place. This all works fine in Firefox of course but IE throws an "Invalid argument" error on this line: "flashObjTag.appendChild(flashEmbedTag);". Any ideas? Here's the full code... var imgUrl = document.getElementById('testImg').src; var flashUrl = imgUrl.replace(/images/, 'swfs'); flashUrl = flashUrl.replace(/jpg/, 'swf'); // Hide the static image document.getElementById('
  2. Is it possible to have a Flash file that is basically just a container with video controls (fast forward, pause, rewind) that JavaScript will pass a variable to and this "container" will play a certain .swf file based of the variable that was passed to it?We have a bunch of .swf files with none of the original source files and want to be able to accomplish something like this were we can use a standard container flash file to control these .swf files.
  3. grippat

    rounding numbers

    Why not just multiply the calculated percentage by 100?
  4. I wrote a simple function to validate a form. All it does right now is take an associative array and go through it making sure each element has a value. If it doesn't it adds to the error array which it returns. For some reason the $field_name inside the loop doesn't contain anything. But if I do a print_r($entry) it gives me this: Array ( ['car'] => ['truck'] => ['bus'] => ['plane'] => ) And here's my function: // Validate entry form. function validateForm($entry) { $err = array(); foreach($entry as $field_name) { $field_name or $err[] = "Field $field_name is requ
  5. Is there a way to use JS to go to a target on a page? When a user clicks on a button I want the JS to automatically bring them to a point lower on the webpage. Is there another better way to achieve the same goal?
  6. How would I write a MySQL statement that will delete all the rows in a table until there's X number left, say 200? Also, if I add ORDER BY rand() would it delete random rows until X number are left? It's sounds malicious I know, but it's just for a demo site we made that we don't want users to have access to ALL the data.
  7. I have a function that I call twice. I have to send it different variables the two times I call it though. One time it's just an ID number, another time it's a different type of ID number and a string. When this function gets called it says It's missing either 1 or two variables depending upon which call. I thought there was a way to set the variables in the function definition so that if a certain variable wasn't passed to it, it would just set it to a default value. Is there a way to do this?
  8. Nevermind, just found the answer myself: the nl2br() function
  9. I have a form which contains a <textarea> element where people are supposed to type several paragraphs. I then use PHP to save this element's contents to a MySQL database. When I use PHP to display the textarea's contents from the database on another page the line breaks have all been removed. Is there a way I can tell PHP or MySQL to preserve the line breaks so the text is in paragraphs?
  10. I'm trying to figure out how to add an event listener to every input tag. I had this:document.getElementsByTagName('input').onkeyup = function () {alert('testing');}But it didn't seem to do anything. My objective is to have JavaScript send entered form info via AJAX every time the user presses a key. There are multiple inputs so I need the same even listener on each.
  11. I have three DIVs that are currently one after another vertically. Is there a way to make it so they line up left to right? I don't want each to have to be on a new line. Thanks!
  12. Is there a way to tell MySQL to return no value whatsoever if a value in a column is NULL? When I do a select on a certain column it returns NULL for some rows and nothing for others. I'd rather have it be consistent.
  13. I want to perform a SELECT on a table and only get rows that have a date of less than 8 months ago. The column that contains the date is in the timestamp format "2007-11-29 12:00:00". How would I do this? Here's the sudo-code: SELECT *FROM exampleWHERE date > 8 months ago
  14. I have two tables: Votes and Addresses. Votes contains just "fname" and "lname" fields. Addresses contains "fname", "lname", "address", etc. How can I use just MySQL to insert the data from Addresses into a 3rd table AddressesWithVotes that have matching fname and lname in the Votes table?
  • Create New...