Изпълнението на този код ми дава следния резултат. Същия е и под IE.
<html>
<head>
<style type="text/css">
div {
border: 5px solid red;
}
</style>
<script type="text/javascript">
function _wrapDivAroundImage(string)
{
return string.replace(/<\s*img[^>]+>/gi,
function(str){
return "<div>"+str+"</div>";
});
}
window.onload = function()
{
document.body.innerHTML = _wrapDivAroundImage(document.body.innerHTML);
}
</script>
</head>
<body>
<img src="http://i.dir.bg/clubs/img/new_clubs_logo.gif" border="0"/>
</body>
</html>
Господ ще ми прости греховете. Това му е работата.Редактирано от Бokop на 13.04.11 15:19.