Hey. I'm looking for a solution that will create, fill and display a container in javascript directly beneath a specific element (no whitespace, margins w.e)

Recommended Answers

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<script type="text/javascript"><!--
function insertAfter(parent, newNode, referenceNode)
{
	parent.insertBefore(newNode, referenceNode.nextSibling);
}
window.dynamicNodeCount=0;
function addElement()
{
	window.dynamicNodeCount++;
	var dad = document.getElementById('container');
	var elementAboveNew = document.getElementById('sib1');
	var newElement = document.createElement('div');
	newElement.innerHTML="Element " +window.dynamicNodeCount;
	insertAfter(dad,  newElement, elementAboveNew); …
Jump to Post

All 2 Replies

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<script type="text/javascript"><!--
function insertAfter(parent, newNode, referenceNode)
{
	parent.insertBefore(newNode, referenceNode.nextSibling);
}
window.dynamicNodeCount=0;
function addElement()
{
	window.dynamicNodeCount++;
	var dad = document.getElementById('container');
	var elementAboveNew = document.getElementById('sib1');
	var newElement = document.createElement('div');
	newElement.innerHTML="Element " +window.dynamicNodeCount;
	insertAfter(dad,  newElement, elementAboveNew);
}
//--></script>
<div onclick="addElement();">Add Element</div>
<div id="container">
	<div id="sib1">a</div>
</div>
</body>
</html>
commented: Hey thanks dude. +3

i am looking for the code that allows me to have a pop up like this site does after a few seconds a div pop up comes up and gray back grounds . what is the code please help
shawn2411@gmail.com my site is
moverscommunity.com

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.