<script language="javascript">
document.execCommand("2D-position",false,true);
var menu;
var bron;
var aantalAfbeeldingen = 0;
var aantal = 0;
function reageerOpOmhoog()
{
naam = bron.src;
document.getElementsByTagName("img").style.zIndex +=1
verwijderContext()
}
function reageerOpOmlaag()
{
naam = bron.src;
document.getElementsByTagName("img").style.zIndex -=1
verwijderContext()
}
function reageerOp90Rechts()
{
window.alert("Rechts");
verwijderContext()
}
function reageerOp90Links()
{
window.alert("Links");
verwijderContext()
}
function reageerOpVerwijder()
{

naam = bron.src;
document.getElementsByTagName("IMG").outerHTML ="";
verwijderContext()
}

function plaatsAfbeelding ( )
{
aantal++;
var invoerVeld = document.getElementById("afbeelding_file");
var nieuweHTML = "<img src='"+invoerVeld.value+"' id='afbeelding"+aantal+"' style='width: 350px;' onContextMenu='toonContextAfbeelding()' onMouseUp='verbergContextAfbeelding()'>";
invoerVeld.outerHTML = "";
document.body.innerHTML += nieuweHTML;
document.getElementById("afbeelding"+aantal).style.left = x;
document.getElementById("afbeelding"+aantal).style.top = y;
aantalAfbeeldingen--;
}

function zoekAfbeelding ( )
{
if ( aantalAfbeeldingen >= 1 )
{
document.body.innerHTML += "";
}
else
{
aantalAfbeeldingen++;
var nieuweHTML = "<input type=\"file\" id=\"afbeelding_file\" onChange=\"plaatsAfbeelding();\">";
document.body.innerHTML += nieuweHTML;
document.getElementById("afbeelding_file").style.left = x;
document.getElementById("afbeelding_file").style.top = y;
}
}

function toonContext()
{
bron = event.srcElement;
var nieuwHTML = "<div id='ContextMenu' style='z-index: 100;'><table border='0' style='padding: 3px; font-family: Arial; font-size: 8pt; width: 195px; background-color: #f5f4f9; border: 1px solid #bcbecb; top:100px; left:100px; cursor:default;'>";
nieuwHTML += "<tr><td onclick=\"zoekAfbeelding(); verbergContext();\" onmouseover=\"this.style.backgroundColor='316AC5'; this.style.color = 'white';\" onmouseout=\"this.style.backgroundColor='#f5f4f9'; this.style.color = 'black';\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Voeg afbeelding toe.</td></tr>";
nieuwHTML += "<tr><td onclick=\"reageerOpOmhoog()\" onmouseover=\"this.style.backgroundColor='316AC5'; this.style.color = 'white';\" onmouseout=\"this.style.backgroundColor='#f5f4f9'; this.style.color = 'black';\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Omhoog</td></tr>";
nieuwHTML += "<tr><td onclick=\"reageerOpOmlaag()\" onmouseover=\"this.style.backgroundColor='316AC5'; this.style.color = 'white';\" onmouseout=\"this.style.backgroundColor='#f5f4f9'; this.style.color = 'black';\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Omlaag</td></tr>";
nieuwHTML += "<tr><td onclick=\"reageerOp90Rechts()\" style=\"border-top: 1px solid #bcbecb;\" onmouseover=\"this.style.backgroundColor='316AC5'; this.style.color = 'white';\" onmouseout=\"this.style.backgroundColor='#f5f4f9'; this.style.color = 'black';\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;90&deg rechts</td></tr>";
nieuwHTML += "<tr><td onclick=\"reageerOp90Links()\" onmouseover=\"this.style.backgroundColor='316AC5'; this.style.color = 'white';\" onmouseout=\"this.style.backgroundColor='#f5f4f9'; this.style.color = 'black';\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;90&deg Links</td></tr>";
nieuwHTML += "<tr><td onclick=\"reageerOpVerwijder()\" style=\"border-top: 1px solid #bcbecb;\" onmouseover=\"this.style.backgroundColor='316AC5'; this.style.color = 'white';\" onmouseout=\"this.style.backgroundColor='#f5f4f9'; this.style.color = 'black';\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Verwijder</td></tr></table></div>";
document.body.innerHTML += nieuwHTML;
document.getElementById("ContextMenu").style.left = event.clientX;
document.getElementById("ContextMenu").style.top = event.clientY;
x = event.clientX;
y = event.clientY;
}

function verbergContext()
{
menu = document.getElementById("ContextMenu");
if(menu != null)
{
menu.outerHTML = "";
}
}
function verbergContextAfbeelding()
{
menu2 = document.getElementById("ContextMenuA");
if(menu2 != null)
{
menu2.outerHTML = "";
}
}
This is mine code to let a popup navagation menu appear with varios functions.
the thing is when i add a picture i want to delete it afterward (to test) or move it above or below another picture. I got the functions working fine first but it wont work on an inserted picture (reason is that it doesnt have an IMG tag) could i get some help on this pls