課程
/前端開發
/JavaScript
/人人網評論功能
老師有源碼嗎
2014-11-21
源自:人人網評論功能 2-1
正在回答
?window.onload = function () {
? ? ? ? ? ??
? ? ? ? ? ? //獲取元素
? ? ? ? ? ? var txt = document.getElementById('txt');
? ? ? ? ? ? var total = document.getElementById('total');
? ? ? ? ? ? //輸入框獲取焦點時
? ? ? ? ? ?txt.onfocus = function(){
? ? ? ? ? ? ? ?this.style.height = 50 + 'px';
? ? ? ? ? ?};
? ? ? ? ? ? //輸入框失去焦點時
? ? ? ? ? ?txt.onblur = function(){
? ? ? ? ? ? ? ?this.style.height = 20 + 'px';
? ? ? ? ? ? //輸入框鍵盤彈起時計算字數
? ? ? ? ? ? txt.onkeyup = function(){
? ? ? ? ? ? ? ? var len = this.value.length;
? ? ? ? ? ? ? ? total.innerText = len;
? ? ? ? ? ? }
? ? ? ? ? ?
? ? ? ? }
舉報
仿人人網評論,讓你的網頁活躍起來,趕快來學習讓功能的實現吧
1 回答誰有css的源碼
3 回答HTML源碼
2 回答JS源碼
1 回答源碼地址??
2 回答源代碼不懂啊
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2015-12-23
?window.onload = function () {
? ? ? ? ? ??
? ? ? ? ? ? //獲取元素
? ? ? ? ? ? var txt = document.getElementById('txt');
? ? ? ? ? ? var total = document.getElementById('total');
? ? ? ? ? ? //輸入框獲取焦點時
? ? ? ? ? ?txt.onfocus = function(){
? ? ? ? ? ? ? ?this.style.height = 50 + 'px';
? ? ? ? ? ?};
? ? ? ? ? ? //輸入框失去焦點時
? ? ? ? ? ?txt.onblur = function(){
? ? ? ? ? ? ? ?this.style.height = 20 + 'px';
? ? ? ? ? ?};
? ? ? ? ? ? //輸入框鍵盤彈起時計算字數
? ? ? ? ? ? txt.onkeyup = function(){
? ? ? ? ? ? ? ? var len = this.value.length;
? ? ? ? ? ? ? ? total.innerText = len;
? ? ? ? ? ? }
? ? ? ? ? ??
? ? ? ? ? ??
? ? ? ? ? ?
? ? ? ? }