兩個文本框內容合二爲一,經過按鈕實現

<!DOCTYPE html>html

< html  lang = "en" >
< head >
     < meta  charset = "UTF-8" >
     < title >Copy Value</ title >
</ head >
< body >
< style >
</ style >
< input  type = "text"  name = ""  id = "J_From" >
< input  type = "button"  value = "添加"  id = "J_Add" >
< input  type = "text"  name = ""  id = "J_To"  readonly>
< script >
(function(){
     var f = document.getElementById('J_From'),
         t = document.getElementById('J_To'),
         b = document.getElementById('J_Add');
     b.onclick = function() {
         var val = f.value;
         val = '+' + val;
         t.value = val;
     };
})();
</ script >
</ body >
</ html >
相關文章
相關標籤/搜索