What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Dynamically changing text box, based on a form input?

Dynamically changing text box, based on a form input?
Author: Message:
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: Dynamically changing text box, based on a form input?
This is tested... For some reason I can't update a div text so I've just used the tooltip for now.... No, you no longer need to define the function as I've put it all in line for you (but doesn't filter out NaN errors etc.

js code:
<form name="MyForm" action="https://www.paypal.com/cgi-bin/webscr" method="post">
  <fieldset>
    <label for="amount">$</label>
    <input id="amount" name="amount" value="5.00" onkeyup="this.title='$'+Math.round((this.value*1)/0.05)"/>
    <label for="custom">Steam ID:</label>
    <input id="custom" name="custom" value="" />
    <input name="business" type="hidden" value="******************" />
    <input name="cmd" type="hidden" value="_xclick" />
    <input name="currency_code" type="hidden" value="USD" />
    <input name="item_name" type="hidden" value="vip" />
    <input name="no_note" type="hidden" value="1" />
    <input name="no_shipping" type="hidden" value="1" />
    <input src="http://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" type="image" alt="Click here to donate">
  </fieldset>
</form>


EDIT: Keep it in the onkeyup event else backspaces won't work and the script won't update after the user deletes a character. You may also need to add a 0 to the end of the tooltip in the event the number rounds to 1 (or even 0) decimal places as zeros get omitted

EDIT2: Big misunderstanding about the rounding. Fixed.

This post was edited on 02-08-2010 at 01:01 AM by Spunky.
<Eljay> "Problems encountered: shit blew up" :zippy:
02-08-2010 12:40 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Dynamically changing text box, based on a form input? - by Jimbo on 02-07-2010 at 09:37 PM
RE: Dynamically changing text box, based on a form input? - by Chrissy on 02-07-2010 at 10:07 PM
RE: Dynamically changing text box, based on a form input? - by stoshrocket on 02-07-2010 at 10:14 PM
RE: Dynamically changing text box, based on a form input? - by Jimbo on 02-07-2010 at 11:03 PM
RE: Dynamically changing text box, based on a form input? - by Spunky on 02-07-2010 at 11:44 PM
RE: Dynamically changing text box, based on a form input? - by Jimbo on 02-08-2010 at 12:15 AM
RE: Dynamically changing text box, based on a form input? - by Spunky on 02-08-2010 at 12:22 AM
RE: Dynamically changing text box, based on a form input? - by stoshrocket on 02-08-2010 at 12:36 AM
RE: Dynamically changing text box, based on a form input? - by Jimbo on 02-08-2010 at 12:37 AM
RE: Dynamically changing text box, based on a form input? - by Spunky on 02-08-2010 at 12:40 AM
RE: Dynamically changing text box, based on a form input? - by Jimbo on 02-08-2010 at 01:08 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On