Forum Moderators: open
i have created my own webpage and got a problem when running it on IE (on firefox it works smoothly)
i have simplified my problem to the following code
the problem is with the call to alert (i.e does not show the alert win while FF does)
Any help will be mostly appreciated
Thanks in advance.
------ code ----
/*
this code is for generating 2 images "buttons"
i need the images to sit one next to each other
and when clicking run some function (i have changed the function to alert just to simplify)
the image button need to be created inside the function since the information for the called function is locally inside the javascript function
*/
<html>
<head>
<title>problematic code</title>
<script type="text/javascript">
function createAddRemove()
{
// start removeFromBasketId
var elem=document.createElement("input");
elem.setAttribute("type","image");
elem.setAttribute("src","img/BasketRemove.jpg");
elem.setAttribute("onclick","alert('remove')");
document.getElementById("removeFromBasketId").appendChild(elem);
// end removeFromBasketId
//start of addToBasketId
var elem=document.createElement("input");
elem.setAttribute("type","image");
elem.setAttribute("src","img/BasketAdd.jpg");
elem.setAttribute("onclick","alert('add')");
document.getElementById("addToBasketId").appendChild(elem);
}
</script>
</head>
<body>
<div>
<a id="addToBasketId"></a>
<a id="removeFromBasketId"></a>
<a href="javascript:createAddRemove();">start</a>
</div>
</body>
</html>