Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. script that autimatically enters a the specified character at a certain point in a text box

script that autimatically enters a the specified character at a certain point in a text box

Scheduled Pinned Locked Moved Web Development
tools
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BPDecaf
    wrote on last edited by
    #1

    Suggested improvement to: a script that autimatically enters a the specified character at a certain point in a text box By webProgrammer Posted: 12 Aug 2003 This script could be improved with the addition of a line to detect and permit the use of the backspace key: function mask(str,textbox,loc,delim){ var locs = loc.split(','); for (var i = 0; i <= locs.length; i++){ for (var k = 0; k <= str.length; k++){ if (k == locs[i]){ if (str.substring(k, k+1) != delim){ if (event.keyCode != 8) //backspace str = str.substring(0,k) + delim + str.substring(k,str.length); } } } } textbox.value = str }

    W 1 Reply Last reply
    0
    • B BPDecaf

      Suggested improvement to: a script that autimatically enters a the specified character at a certain point in a text box By webProgrammer Posted: 12 Aug 2003 This script could be improved with the addition of a line to detect and permit the use of the backspace key: function mask(str,textbox,loc,delim){ var locs = loc.split(','); for (var i = 0; i <= locs.length; i++){ for (var k = 0; k <= str.length; k++){ if (k == locs[i]){ if (str.substring(k, k+1) != delim){ if (event.keyCode != 8) //backspace str = str.substring(0,k) + delim + str.substring(k,str.length); } } } } textbox.value = str }

      W Offline
      W Offline
      webProgrammer
      wrote on last edited by
      #2

      thanks for the addition, I was about to add that myself, when I noticed your addition/fix.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups