誰かが私にラインで、この簡単な方法でjavascriptコードのこの部分を説明してくださいできますか?私はこのように書きwhcih外部のJavaScriptファイルを持っている ; - 。JavaScriptフォームの検証コードのヘルプが必要
// Make this function external like I did in the video
function _(x){
return document.getElementById(x);
}
/* And all over the site from now on you can get html elements by their id
by simply using*/
_( "DIV1")innerHTMLの=の "Hello World";
とコードの上、この
function restrict(elem){
var tf = _(elem);
var rx = new RegExp;
if(elem == "email"){
rx = /[' "]/gi;
} else if(elem == "username"){
rx = /[^a-z0-9]/gi;
}
tf.value = tf.value.replace(rx, "");
}
あなたが検索し、理解しようとしたリソースのリンクを投稿してください。これを理解するためにあなたが傾けるもの –