hallo forum, im nachfolgendem code ist ein kleiner wysiwyg-editor zu sehen, der im ff wunderbar funktioniert und eigendlich auch im ie, bis auf die tatsache das ich da keine farben aendern kann und ich bekomms einfach nciht hin das entsprechnd zu machen. ich hab schon gesucht, aber leider ohne erfolg, habt ihr evtl eine idee wie ich das problem loesen kann ?
***schnipp***
<html>
<head>
<style>
#color{
position: absolute;
visibility: hidden;
overflow: auto;
}
</style>
<script type="text/javascript">
function init(){
ifrm = frames[0].document;
ifrm.designMode = 'on';
buttons = document.getElementsByTagName('span');
for(i in buttons){
if(buttons[i].className == "button")
buttons[i].onclick = machsmir;
}
}
function machsmirbunt(color){
document.getElementById('color').style.visibility = 'hidden';
ifrm.execCommand("ForeColor",false,color);
}
function machsmir(){
document.getElementById('color').style.visibility = 'hidden';
if(this.id == "fontsize"){
sel = document.getElementById(this.id).childNodes;
uagent = navigator.userAgent.toLowerCase();
if(uagent.match('msie') && !uagent.match('opera') && (!uagent.match('msie 5.5')||!uagent.match('msie 6.')))
sel = sel[0];
else
sel = sel[1];
arg = sel.options[sel.selectedIndex].firstChild.data;
}
else
arg = null;
ifrm.execCommand(this.id,false,arg);
}
function test(){
alert(frames[0].document.body.innerHTML);
}
function set_color(x,y){
document.getElementById("color").style.left = x;
document.getElementById("color").style.top = y+20;
document.getElementById("color").style.width = 200;
document.getElementById("color").style.height = 200;
document.getElementById("color").style.visibility = "visible";
}
</script>
</head>
<body onload="init()">
<span class="button" id="bold"><b><a href="#" onclick="return false">B</a></b></span> |
<span class="button" id="italic"><i><a href="#" onclick="return false">K</a></i></span> |
<span class="set_color" onclick=";set_color(this.offsetLeft,this.offsetTop);">farbe</span> |
<span class="button" id="fontsize">
<select>
<option>1</option>
<option>2</option>
<option selected="selected">3</option>
<option>4</option>
<option>5</option>
<option>6</option>
<option>7</option>
</select>
</span>
<form onsubmit="return false" id="form" action="" method="post">
<iframe id="der_iframe" width="500" height="300"></iframe>
<br>
<input type="submit" value="schicks los">
</form>
<br>
<span onclick="test();">test</span>
<div id="color">
<table width="137" height="86" border="0" cellpadding="0" cellspacing="1" bgcolor="#000000">
<tr>
<td style="background-color: #000000" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #A0522C" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #566B30" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #006401" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #483D8B" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #010082" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #4B0081" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #2F4F4E" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
</tr>
<tr>
<td style="background-color: #8B0101" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #FF8B00" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #7F8001" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #008001" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #008081" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #0000FE" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #708090" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #696969" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
</tr>
<tr>
<td style="background-color: #FE0000" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #F4A361" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #9ACD32" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #2E8A57" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #48D0CC" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #4C6AC2" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #820180" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #808080" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
</tr>
<tr>
<td style="background-color: #FF00FE" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #FEA500" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #FFFF00" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #01FF01" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #00FFFF" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #00BFFE" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #9931CC" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #A8A8A0" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
</tr>
<tr>
<td style="background-color: #FFC0CB" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #F5DEB4" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #FEFACD" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #99FB98" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #AEEEF0" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #ADD9E6" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #DDA0DC" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
<td style="background-color: #FFFEFF" onclick="machsmirbunt(this.style.backgroundColor);"> </td>
</tr>
</table>
</div>
</body>
</html>
***schnapp***