' VBScript File
sub check_txtNama()
    Dim keep_going
    Dim test_array()
    Dim newval, nonasciival
    ' AscII set 65-90 & 97-122 = a-z A-Z
    ' AscII set 48-57 = 0-9
    ' AscII set 39 = '
    strvalue = document.activeElement.getAttribute("value")
    newval = ""

    for n=1 to len(strvalue)
        asciivalue= trim(asc(mid(strvalue,n,1)))
        nonasciival = mid(strvalue,n,1)'trim(mid(strvalue,n,1))

        for c=0 to 9
        redim preserve test_array(c)
        test_array(c) = trim(c+48)
        next

        for c=10 to 35
        redim preserve test_array(c)
        test_array(c) = trim(c+55)
        next

        for c=36 to 61
        redim preserve test_array(c)
        test_array(c) = trim(c+61)
        next    

        keep_going=false
        for c=0 to 61
        if asciivalue = test_array(c) then
            keep_going = true
        end if
        next

        if keep_going = false then
            window.alert ("Sila Masukkan Huruf A-Z atau angka 0-9 Sahaja.")
            document.activeElement.setAttribute "value",newval
            exit for
        end if
        newval = newval & nonasciival
    next
end sub
