Results 1 to 3 of 3

Thread: strip off characters and return value

  1. #1
    Join Date
    Sep 2005

    strip off characters and return value

    Hi all,
    I'm looking for a client side script to strip off characters from a swipe card and return the value. On page load the cursor needs to be focussed on textbox1. When i swipe a magnetic card in textbox1 for example, my number looks like this yc99960005785. i need to strip off yc999 and return the next 8 characters to the same textbox1. I'm guessing the best way to do it is to use a javascript function. Problem is I don't know javascript at all or how to call it from asp.net textbox control as soon as the card is swiped. Want to avoid clicking a button to call the function. needs to be triggered when the card is swiped.

    I've looked for scripts that I think might do it and perhaps a variation on the following might do.......

    <SCRIPT LANGUAGE="JavaScript">
    function setFocus()

    <script type="text/javascript">
    function stripChar(str,two){
    var reg = (two)? /^.{2}/ : /^.{3}/
    return str.replace(reg,"");

    <form runat="server" ID="Form1">
    <asp:TextBox ID="Textbox1" runat="server" myjavascriptfunctionname />

    I'm hoping to be able to parse the returned value from textbox1 and feed it into a stored procedure server side. Appreciate any help

  2. #2
    Join Date
    May 2003
    Between Baltimore and DC
    You try substring?

    Tech Author [Ajax In Action, JavaScript: Visual Blueprint] | twitter | linkedin | http://www.pascarello.com

  3. #3
    Join Date
    Sep 2005
    Quote Originally Posted by A1ien51
    You try substring?

    not on the client side. I tried substring within a vb.net sub routine but couldn't get it to strip off the values and

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center