我想用javascript / jquery创建父子div的动态,我有用HTML创建的div。 [英] I want to create the parent child div's dynamicaly using javascript/jquery, I have div which created in HTML.
问题描述
<div id="chatContainer">
<div id="chatHeader" onclick="myfunction();">
<img src="https://img/chaticon.png" style="vertical-align:middle;"/> Chat with us
</div>
<div id="chatBody">
<div id="Openhours">
<iframe id="chatframe" src="https://www.chatmepage/Saleschat/">
</iframe>
</div>
<div id="Closedhours">
Sales hours are closed please <a target="_parent" href="https://www.xyz.com/contact"> Contact </a> our Agents
</div>
</div>
</div>
我尝试过:
onclick按钮我附加了div,但是我需要创建页面的div onload。
<!DOCTYPE html>
#chtping
{
vertical-align:middle;
}
#myForm
{
位置:固定;
背景颜色:#fff;
底部:0;
右:calc(50% - 200px);
颜色:#fff;
z-index:10;
font-size :18px;
溢出:隐藏;
font-weight:bold;
background-color:#00a9e0;
border -radius:5px;
border-radius:5px 5px 0px 0px;
}
#chatbody
{
颜色:rgb(0,0,0);
font-weight:normal;
font-size:13px;
身高:455px;
填充:10px;
border-right-width:1px;
border-right-style:solid;
border-right-color:rgb(204,204,204);
border-left-width:1px;
border-left-style:solid;
border-left-color:rgb(204,204,204);
display:none ;
背景颜色:白色;
}
#myframe
{
宽度:100%;
身高:100%;
位置:固定;
margin-left:5px;
边框:0;
}
点击按钮创建一个FORM和一个INPUT元素。
What I have tried:
onclick of the button I am appending the div, but I need to create the div onload of the page.
<!DOCTYPE html>
#chtping
{
vertical-align:middle;
}
#myForm
{
position: fixed;
background-color: #fff;
bottom: 0;
right:calc(50% - 200px);
color: #fff;
z-index: 10;
font-size: 18px;
overflow:hidden;
font-weight: bold;
background-color: #00a9e0;
border-radius: 5px;
border-radius: 5px 5px 0px 0px;
}
#chatbody
{
color: rgb(0, 0, 0);
font-weight: normal;
font-size: 13px;
height: 455px;
padding: 10px;
border-right-width: 1px;
border-right-style: solid;
border-right-color: rgb(204, 204, 204);
border-left-width: 1px;
border-left-style: solid;
border-left-color: rgb(204, 204, 204);
display:none;
background-color: white;
}
#myframe
{
width:100%;
height:100%;
Position:fixed;
margin-left:5px;
border:0;
}
Click the button to create a FORM and an INPUT element.
推荐答案
检查出来: onload Event [ ^ ]
这篇关于我想用javascript / jquery创建父子div的动态,我有用HTML创建的div。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!