Author Topic: PHP & JavaScript Help  (Read 3244 times)

Canuck

  • Eh?!!
  • Founders
  • Posts: 792
  • Karma: +51/-3
  • Andy Moog Fan
    • My Website
PHP & JavaScript Help
« on: February 27, 2006, 11:06:35 PM »
Ive been working on a guestbook with php recently and ran into a few problems.

Hillbillie suggested I used an image-rendering library, so that the users would have to input this information and prevent scripts from continually posting.  My host doesn't provide one, would creating random images with PHP work just as good?, or should I create some images myself and randomly go through them?

When performing client side validation with JavaScript DIVs appear above the submission form with an error message.  If the user fixes an error and submits again, the DIV with the error disappears.  When I used display:none, Firefox and Oprea removed the div itself and the text, however IE didnt remove the text.  I fixed that by setting innnerHTML = "".  The problem is the height of the div still remains.  Ive tried:

Code: [Select]

document.getElementById("").height = 0;
document.getElementById("").style.height = 0;


and neither work, anyone know how to access the DIV height?

Thanks

ober

  • Ashton Shagger
  • Ass Wipe
  • Posts: 14310
  • Karma: +73/-790
  • mini-ober is taking over
    • Windy Hill Web Solutions
PHP & JavaScript Help
« Reply #1 on: February 28, 2006, 09:58:48 AM »
If your host doesn't provide GD, then I don't think you're going to be able to use PHP to generate images.  I'd suggest creating several manually and using PHP to pick a random one.

How are you removing the div?  I do something similar at work and IE hides the divs just like FF and Opera.

example:
Code: [Select]

function showfactors()
{
d1=document.getElementById('divfactor')
if ((d1.style.display == 'none') || (d1.style.display == ''))
   d1.style.display = 'block'
else
   d1.style.display = 'none'
}

Canuck

  • Eh?!!
  • Founders
  • Posts: 792
  • Karma: +51/-3
  • Andy Moog Fan
    • My Website
PHP & JavaScript Help
« Reply #2 on: February 28, 2006, 12:31:03 PM »
I was removing the div by calling a function which change the class of the div, which had a property of display:none, but that wasnt enough for IE to remove it...

You helped me with something like this before, but I forgot about it.. I got it to work.  

Thanks again.

edit:  For the images I create, I was thinking of a 4 or 5 alpha numeric code, I think that would be sufficient...

edit2: Found this script

http://www.php-mysql-tutorial.com/user-authentication/image-verification.php

and it worked on my host's server, so Ill probably use it, or do an alpha-numeric one.
« Last Edit: February 28, 2006, 01:18:59 PM by Canuck »

ober

  • Ashton Shagger
  • Ass Wipe
  • Posts: 14310
  • Karma: +73/-790
  • mini-ober is taking over
    • Windy Hill Web Solutions
PHP & JavaScript Help
« Reply #3 on: March 01, 2006, 08:24:13 AM »
I would do alphanumeric.  But that's just me.