課程
/前端開發(fā)
/JavaScript
/人人網(wǎng)評論功能
老師有源碼嗎
2014-11-21
源自:人人網(wǎng)評論功能 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';
? ? ? ? ? ? //輸入框鍵盤彈起時計算字?jǐn)?shù)
? ? ? ? ? ? txt.onkeyup = function(){
? ? ? ? ? ? ? ? var len = this.value.length;
? ? ? ? ? ? ? ? total.innerText = len;
? ? ? ? ? ? }
? ? ? ? ? ?
? ? ? ? }
舉報
仿人人網(wǎng)評論,讓你的網(wǎng)頁活躍起來,趕快來學(xué)習(xí)讓功能的實現(xiàn)吧
1 回答誰有css的源碼
3 回答HTML源碼
2 回答JS源碼
1 回答源碼地址??
2 回答源代碼不懂啊
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
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';
? ? ? ? ? ?};
? ? ? ? ? ? //輸入框鍵盤彈起時計算字?jǐn)?shù)
? ? ? ? ? ? txt.onkeyup = function(){
? ? ? ? ? ? ? ? var len = this.value.length;
? ? ? ? ? ? ? ? total.innerText = len;
? ? ? ? ? ? }
? ? ? ? ? ??
? ? ? ? ? ??
? ? ? ? ? ?
? ? ? ? }