English 中文(简体)
加密输入文本,并在处理网络表格时加以加密
原标题:Encrypting entered text and decrypting it while processing a web form

我想在网上有一个文本箱,有自己的加密和加密程序。 用户进入“gwkki”,即“hello”。

此处的加密钥匙是正确信函之后的关键板上的每一封信:

h turns to g
e turns to w
l turns to k
o turns to i

“hello”改为“gwkki”

我希望,一旦文本箱中的“gwkki”用户类型出现,文本箱就会显示“hello”。 Can 我写了一封信,用这一编码办法监测每个关键人物并替换每封信件?

问题回答

可以用纯js或js和php来做到这一点。

您可以利用在html上的“Change”活动手记,跟踪对外地所作的变化:

<input type="text" id="fieldName" onchange="encode(this.id)">

and then you can write a simple function like :

<script type="text/javascript">
function upperCase(x)
{
var y=document.getElementById(x).value

//HERE YOU DECODE/ENDCODE the variable


//AND THEN DISPLAY IT WHERE EVER YOU WANT
document.getElementById(**THIS IS THE ID OF WHERE YOU WANNA DISPLAY THE VALUE**).value=y
}
</script>

http://www.w3schools.com/jsref/jsref_replace.asp”rel=“nofollow” http://www.w3schools.com/jsref/jsref_replace.asp。

你可以。 当用户集中关注这些投入时(可使用focusblur。 当用户集中关注这一投入时,可以听取<代码>keypress活动的关键词句,并且你可以抓住最后一封被点击的信函的价值,假定该信不是删除的关键,并适当编码。

处理改变最后特性的一些伪装编码。 并非完全正确:

var listenForKeyPress = function (e) {
  if ($.inArray(e.keyCode, ARRAY_OF_CHARS_TO_ENCODE)) {
    var el = $(this),
        value = el.val();

    // Set the value after we encode it
    el.val(value.slice(0, value.length - 2) + encode(value[value.length - 1]);
  }
};

$( #my-input ).focus(function () {
  $(this).bind( keypress , listenForKeyPress);
});

$( #my-input ).blur(function () {
  $(this).unbind( keypress , listenForKeyPress);
});




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签