亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

JavaScript實現(xiàn)簡單評論功能

 更新時間:2017年08月17日 08:37:37   作者:wwj18368915379  
這篇文章主要為大家詳細介紹了JavaScript實現(xiàn)簡單評論功能,具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了JavaScript實現(xiàn)簡單評論功能的具體代碼,供大家參考,具體內(nèi)容如下

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style type="text/css">
body{
/*background-image: url(../img/91R58PIC3n2_1024.jpg);*/
}
#div1{
margin: auto;
border: 1px beige solid;
width: 512px;
text-align: right;
}
ul{
list-style-type: none;
list-style-image: url(../img/touxiang.png);

}
.box{
width: 400px;
height: 150px;
/*background-color: yellow;*/
border: 1px darkgray solid;
border-radius: 30px;
position: relative;
}
.box .touxiang{
width: 80px;
height: 80px;
background-image: url(../img/touxiang.png);
background-size: 100% 100%;
position: absolute;
left: 10px;
top: 10px;
}
.box .nicheng{
width: 80px;
height:25px ;
/*background-color: red;*/
position: absolute;
left: 10px;
top: 100px;
font-size: 12px;
text-align: center;
line-height: 25px;
}
.box .pinglun{
width: 290px;
height: 80px;
/*background-color: cyan;*/
position: absolute;
top: 10px; 
right: 10px; 
}
.box .shijian{
width: 200px;
height: 25px;
/*background-color: green;*/
position: absolute;
top: 100px;
left:100px;
}


</style>

<script>
window.onload=function(){
var oTxt = document.getElementById("txt");
var oBtn = document.getElementById("btn1");
var oUl1 = document.getElementById("ul1");


oBtn.onclick=function(){
var oBox = document.createElement("div");
oBox.className = "box";

//創(chuàng)建頭像
var oDiv = document.createElement("div");
oDiv.className = "touxiang";
oBox.appendChild(oDiv);

var oDiv = document.createElement("div");
oDiv.className = "nicheng";
oDiv.innerHTML = "指尖微涼*";
oBox.appendChild(oDiv);

var oDiv = document.createElement("div");
oDiv.className = "pinglun";
oDiv.innerHTML = oTxt.value;
oBox.appendChild(oDiv);

var oDiv = document.createElement("div");
oDiv.className = "shijian";
var oDate = new Date();
//oDate.getFullYear

oDiv.innerHTML ="評論時間&nbsp;&nbsp;"+ oDate.getFullYear()+"年"+(oDate.getMonth()+1)+"月"+oDate.getDate()+"日"+"<a href='javascript:;'>刪除</a>";




oBox.appendChild(oDiv);

oUl1.appendChild(oBox);

/*oBox.insertBefore(oUl1,oDiv[0]);*/

var aA = oDiv.getElementsByTagName("a");

for(var i = 0;i<aA.length;i++)
{
aA[i].onclick=function(){
oDiv.removeChild(this.parentNode);
}
}

}
}

</script>



</script>
</head>
<body>
<h2 align="center">網(wǎng)易云熱評</h2>
<div id="div1" >
<textarea cols="70" rows="8" id="txt"></textarea><br />
<input type="button" value="評論" id="btn1" />

<ul id="ul1">

</ul>
</div> 
</body>
</html>

效果圖:

以上就是本文的全部內(nèi)容,希望對大家的學習有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • Bootstrap實現(xiàn)input控件失去焦點時驗證

    Bootstrap實現(xiàn)input控件失去焦點時驗證

    這篇文章主要介紹了Bootstrap實現(xiàn)input控件失去焦點時驗證的相關(guān)資料,非常不錯,需要的朋友可以參考下,需要的朋友可以參考下
    2016-08-08
  • 純js代碼制作的網(wǎng)頁時鐘特效【附實例】

    純js代碼制作的網(wǎng)頁時鐘特效【附實例】

    下面小編就為大家?guī)硪黄僯s代碼制作的網(wǎng)頁時鐘特效【附實例】。小編覺得聽錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2016-03-03
  • uni-app小程序沉浸式導航實現(xiàn)的全過程

    uni-app小程序沉浸式導航實現(xiàn)的全過程

    在跨端項目開發(fā)中,uniapp是個不錯的框架,下面這篇文章主要給大家介紹了關(guān)于uni-app小程序沉浸式導航實現(xiàn)的相關(guān)資料,文中通過實例代碼介紹的非常詳細,需要的朋友可以參考下
    2022-10-10
  • 利用Javascript實現(xiàn)一套自定義事件機制

    利用Javascript實現(xiàn)一套自定義事件機制

    隨著web技術(shù)發(fā)展,使用JavaScript自定義對象愈發(fā)頻繁,讓自己創(chuàng)建的對象也有事件機制,通過事件對外通信,能夠極大提高開發(fā)效率。下面這篇文章主要給大家介紹了關(guān)于利用Javascript實現(xiàn)一套自定義事件機制的相關(guān)資料,需要的朋友可以參考下。
    2017-12-12
  • Bootstrap被封裝的彈層

    Bootstrap被封裝的彈層

    這篇文章主要介紹了Bootstrap被封裝的彈層 的相關(guān)資料,非常不錯,具有參考借鑒價值,需要的朋友可以參考下
    2016-07-07
  • js中var、let、const之間的區(qū)別

    js中var、let、const之間的區(qū)別

    本文主要介紹了js中var、let、const之間的區(qū)別,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面隨著小編來一起學習學習吧
    2023-05-05
  • 微信小程序選擇圖片控件

    微信小程序選擇圖片控件

    這篇文章主要為大家詳細介紹了微信小程序選擇圖片控件,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2021-01-01
  • JavaScript Proxy基本用法詳解

    JavaScript Proxy基本用法詳解

    這篇文章主要介紹了JavaScript Proxy基本用法,Proxy對象用于創(chuàng)建一個對象的代理,從而實現(xiàn)基本操作的攔截和自定義,如屬性查找、賦值、枚舉、函數(shù)調(diào)用等
    2022-12-12
  • Firebug入門指南(Firefox瀏覽器)

    Firebug入門指南(Firefox瀏覽器)

    據(jù)說,對于網(wǎng)頁開發(fā)人員來說,F(xiàn)irebug是Firefox瀏覽器中最好的插件之一。
    2010-08-08
  • js判斷樣式className同時增加class或刪除class

    js判斷樣式className同時增加class或刪除class

    用正則表達式判斷多個class之間是否存在真正的class(前后空格的處理)然后增加class刪除class,本文給予實現(xiàn)方法,感興趣的朋友可以了解下,或許對你有所幫助
    2013-01-01

最新評論