Link to home
Start Free TrialLog in
Avatar of davidsperling
davidsperling

asked on

Javascript regex, timer and string-split

I need the following functionality:

-User enters a string in a textbox
-If the string matches an integer, followed by ; and then follwed by a date - then after one second split the string into integer/date and put into two separate textboxes.

Is that hard...?

(you can run index.html directly in your browser)



[index.html]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en">
<head>
    <title>advanced js...</title>
    <style type="text/css">
        p{
            font-style: italic;
            font-size: large;
            
        }
    </style>
    <script type="text/javascript">
        function clrAll(){
            document.getElementById("input").value="";
            document.getElementById("number").value="";
            document.getElementById("date").value="";
        }
    </script>
</head>

<body bgcolor="whitesmoke">
    
    Please enter 666;2012-12-31 :<br/>
    <input type="text" id="input" size="40"/>
    
    <p>After one second, split input into these boxes if input matches integer;date ...:</p>
    
    
    Integer goes here:<br/>
    <input type="text" id="number" size="20"/>
    <br /><br />
    Date goes here:<br/>
    <input type="text" id="date" size="20"/>


    <br />
    <button onclick='clrAll()'>Clear</button>

</body>

</html>

Open in new window

ee.png
index.html
ASKER CERTIFIED SOLUTION
Avatar of HonorGod
HonorGod
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of davidsperling
davidsperling

ASKER

Don't worry, you're not helping me cheating with homework. It's a real world project ;-)
It's just that my js kung-fu is a bit rusty.
Yes!
Thanks for the grade & points.

Good luck & have a Merry Christmas.