Jump to content


Photo

Button onClick/onSubmit the button's value will change.


  • Please log in to reply
3 replies to this topic

#1 marknt

marknt
  • Members
  • PipPipPip
  • Advanced Member
  • 34 posts
  • LocationPhilippines

Posted 28 September 2006 - 03:08 AM

Hello everyone. I have a problem with javascript. I want to change the value of my button when the form is submitted or the button is clicked. Like in www.myspace.com

Notice if you click the Login button in myspace.com, the button's value will change to "Logging In"

I've been googling it but all i get is wrong links.

Please help thanks in advance. More power PHPfreaks  :)

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 28 September 2006 - 09:16 AM

You'll need to add the following into your submit button tag:
onclick="this.value = 'Logging In...'"

Eg:
<input type="submit" name="login_btn" value="Login" onclick="this.value = 'Logging In...'" />


#3 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 28 September 2006 - 03:03 PM

In general, you should probably revert the button text after a certain time interval... often, the button is disabled as well onclic.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#4 marknt

marknt
  • Members
  • PipPipPip
  • Advanced Member
  • 34 posts
  • LocationPhilippines

Posted 30 September 2006 - 01:38 AM

Ah ok thanks. After posting my question here in phpfreaks forum, i found out the answer to my question. Anyway thanks a lot sir fenway and sir wildteen88 for your help.

One of my dreams is to have a Zend PHP certification someday  ;D




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users