欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

JavaScript實(shí)現(xiàn)簡單評(píng)論功能

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

本文實(shí)例為大家分享了JavaScript實(shí)現(xiàn)簡單評(píng)論功能的具體代碼,供大家參考,具體內(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 ="評(píng)論時(shí)間&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)易云熱評(píng)</h2>
<div id="div1" >
<textarea cols="70" rows="8" id="txt"></textarea><br />
<input type="button" value="評(píng)論" id="btn1" />

<ul id="ul1">

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

效果圖:

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

相關(guān)文章

  • Bootstrap實(shí)現(xiàn)input控件失去焦點(diǎn)時(shí)驗(yàn)證

    Bootstrap實(shí)現(xiàn)input控件失去焦點(diǎn)時(shí)驗(yàn)證

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

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

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

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

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

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

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

    Bootstrap被封裝的彈層

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

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

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

    微信小程序選擇圖片控件

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

    JavaScript Proxy基本用法詳解

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

    Firebug入門指南(Firefox瀏覽器)

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

    js判斷樣式className同時(shí)增加class或刪除class

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

最新評(píng)論