How to code something like this?
2014-01-23, 02:11 PM,
#1
So I'm wondering how do I code something like this.

There's a Generate button, next to it, there's a box. When the user hits the button it displays a code like this 999-8726-1111-XXXX?

How do I do it?
Reply
2014-01-23, 08:21 PM,
#2
Reply
2014-01-23, 08:27 PM,
#3
Reply
2014-01-24, 11:25 AM,
#4
I'm going to code it for a website *-*
Reply
2014-01-24, 11:42 AM,
#5
(2014-01-24, 11:25 AM)ajet369 Wrote: I'm going to code it for a website *-*

Good luck! if you need need any help send me a pm.

Your Future Isn't Programmed.
Learn All You Can, While You Can.
Reply
2014-01-24, 11:46 AM,
#6
(2014-01-24, 11:25 AM)ajet369 Wrote: I'm going to code it for a website *-*

I have coded some online generator like that pm me if intrested
Reply
2014-01-24, 12:10 PM,
#7
If it's for a website, you could use HTML (and CSS) + PHP. Otherwise, if it's a computer program, you can get it done in almost any language (C, C++, C#, VB.NET, Delphi etc)
Reply
2014-01-24, 12:16 PM,
(This post was last modified: 2014-01-24, 12:17 PM by Bino.)
#8
First, add this javascript function:
PHP Code:
function gencode()
{
    var 
text "";
    var 
possible "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    
    for( var 
i=014i++ )
        
text += possible.charAt(Math.floor(Math.random() * possible.length));
        
output text.match(/.{1,14}/g);

    return 
output;


Change the 14 to however long you want the code to be.

Then, add this code to your button.

PHP Code:
onclick="javascript:document.getElementById('code').value = gencode();" 

And add this to your input (textbox) tag
PHP Code:
id="code" 

How it works:
The gencode function generates a random string. Then, the document.getElementById finds the element with the ID "code" (which you make your text box) and then changes the value of it (the text within the textbox) to the output of the gencode function.

Hope this helps.
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Where to find content locker code on a pre designed landing page? Holyearnings 3 153 2017-09-13, 06:56 AM
Last Post: Holyearnings
  OGads captcha locker onclick code ? gamertrial1 1 175 2017-08-11, 10:04 AM
Last Post: lovecash
  Decode this .js code roktim 11 446 2017-07-24, 09:27 PM
Last Post: Harrington
  how to youtube verify code phone ? warrensandre25 2 149 2017-07-23, 07:29 AM
Last Post: Padfoot
  [HELP] How Do I Remove Widget Container From The Code blunt 0 143 2017-06-14, 11:35 PM
Last Post: blunt




About Us | Contact Us | CPA Elites | Advertise | Stats | Staff Team

© 2013-2017 CPA Elites Ltd
Enhanced by MyBB and WallBB
Return to top