As follows:
The code is as follows:
!doctype html>
<meta charset= "Utf-8" >
<title> Untitled Document </title>
<style>
Body {
width:100%;
height:100%;
}
* {
margin:0 Auto;
padding:0;
}
#bgimg1 {
background-size:100% 100%;
position:relative;
Text-align:center;
Background-image:url (.. /img/iphone.png);
width:404px;
height:800px;
}
#bgcolor1 {
Overflow-y:auto;
Overflow-x: Hidden;
Position:absolute;
Text-align:left;
left:45px;
top:125px;
width:305px;
}
#bgcolor2 {
left:47px;
top:640px;
width:310px;
height:40px;
Position:absolute;
}
#text1 {
margin-left:25px;
Border:none;
border-radius:5px;
height:30px;
width:220px;
}
#btn1 {
Border:none;
border-radius:4px;
width:30px;
height:30px;
Background: #f0f0f0;
}
#change1 {
Position:absolute;
Float:left;
Background: #FFF;
Border:thin 1px;
left:4px;
width:30px;
height:30px;
border-radius:5px;
}
#btn1: hover {
Cursor:pointer;
}
/* #bgcolor2 img{
left:-2px;
Position:absolute;
Background: #FFF;
Border:thin 1px;
border-radius:4px;
width:30px;
height:28px;*/
#change1: hover {
Cursor:pointer;
}
#ul1 {
List-style-type:none;
}
. sp01 {
Color: #fff;
padding-left:5px;
padding-right:5px;
margin-left:30px;
Word-break:break-all;
/* Note: If you do not add a forced line break, Chinese can wrap, and English will not be wrapped automatically.
Display:inline-block;
line-height:28px;
BORDER:1PX Thin;
border-radius:5px;
Background: #9C3;
}
. sp02 {
Color: #FFFF99;
padding-left:5px;
padding-right:5px;
margin-right:30px;
Word-break:break-all;
/* Note: If you do not add a forced line break, Chinese can wrap, and English will not be wrapped automatically.
Display:inline-block;
line-height:28px;
BORDER:1PX Thin;
border-radius:5px;
Color: #9c3;
Background:yellow;
Float:right;
}
. pic01 {
width:265px;
Background:url (.. /img/1.jpg) No-repeat left top;
Float:left;
margin-top:10px;
margin-left:10px;
}
/* Note: Do not set the height of the div, so the height of the div will vary with the content, by the content height */
. pic02 {
width:265px;
Background:url (.. /img/2.jpg) No-repeat right top;
Float:right;
margin-top:10px;
margin-right:10px;
}
</style>
<body>
<div id= "BGIMG1" >
<div id= "Bgcolor1" >
<!--This div is used to put JS generated content--
</div>
<div id= "Bgcolor2" >
<input type= "text" value= "" id= "Text1" >
<input type= "button" value= "Send" id= "BTN1" >
</div>
</div>
<script>
Window.onload = function () {
var oform = document.getElementById ("Form1");
var otext = document.getElementById ("Text1");
var obtn = document.getElementById ("btn1");
var ochange = document.getElementById ("Change1");
var ocontent = document.getElementById ("Bgcolor1");
var Oul = document.getElementById ("Ul1");
var onOff = true;
var oset=ocontent.offsetheight;/* gets the height of the element. Note: If the style is not written in line, it is not possible to get the height of the element directly through the style.width */
Ochange.onclick = myFunction; /* Toggle Chat Pictures */
function MyFunction () {
if (ONOFF) {
OCHANGE.SRC = '. /img/2.jpg ';
OnOff = false;
} else {
OCHANGE.SRC = '. /img/1.jpg ';
OnOff = true;
}
}
Obtn.onclick = function () {
if (Otext.value = = ") {
Alert (' Please input content bar ~ ~ ');
}//Note: In parentheses of alert (), strings are quoted.
else {
if (ONOFF) {
ocontent.innerhtml + = ' <div class= ' pic01 ' > ' + ' <span class= ' sp01 ' > ' + otext.value + ' </span> ' + ' </di V> ';
} else {
ocontent.innerhtml + = ' <div class= ' pic02 ' > ' + ' <span class= ' sp02 ' > ' + otext.value + ' </span> ' + ' </di V> ';
};
Otext.value = ";
}
};
/* if (oset==0) {ocontent.style.overflowy= ' scroll '};*/
}
</script>
</body>
---restore content ends---
---restore content ends---
Jsiphone Mobile phone operation