Der er ingen af tingene som virker :/
Her er min javascript del:
<script language="JavaScript">
function startEditor()
{
document.getElementById('editable').contentWindow.document.designMode = 'ON';
document.getElementById('editable').body.style.fontFamily = 'tahoma';
document.getElementById('editable').contentWindow.document.open();
document.getElementById('editable').contentWindow.document.write();
document.getElementById('editable').contentWindow.document.close();
}
function toolbar()
{
document.write('<tr>');
document.write(' <td style="width: 21px; height: 20px"><button onClick="action(\'bold\')"><img src="images/toolbar/bold.gif" style="width: 21px; height: 20px"></button></td>');
document.write(' <td style="width: 21px; height: 20px"><button onClick="action(\'italic\')"><img src="images/toolbar/italic.gif" style="width: 21px; height: 20px"></button></td>');
document.write(' <td style="width: 21px; height: 20px"><button onClick="action(\'underline\')"><img src="images/toolbar/underline.gif" style="width: 21px; height: 20px"></button></td>');
document.write(' <td style="width: 21px; height: 20px"><button onClick="action(\'justifyleft\')"><img src="images/toolbar/justifyleft.gif" style="width: 21px; height: 20px"></button></td>');
document.write(' <td style="width: 21px; height: 20px"><button onClick="action(\'justifycenter\')"><img src="images/toolbar/justifycenter.gif" style="width: 21px; height: 20px"></button></td>');
document.write(' <td style="width: 21px; height: 20px"><button onClick="action(\'justifyright\')"><img src="images/toolbar/justifyright.gif" style="width: 21px; height: 20px"></button></td>');
document.write(' <td style="width: 21px; height: 20px"><button onClick="action(\'justifyfull\')"><img src="images/toolbar/justifyfull.gif" style="width: 21px; height: 20px"></button></td>');
document.write(' <td style="width: 21px; height: 20px"><button onClick="createImage()"><img src="images/toolbar/image.gif" style="width: 21px; height: 20px"></button></td>');
document.write(' <td style="width: 21px; height: 20px"><button><img src="images/toolbar/link.gif" style="width: 21px; height: 20px"></button></td>');
document.write(' <td style="width: 21px; height: 20px"><button><img src="images/toolbar/mail.gif" style="width: 21px; height: 20px"></button></td>');
document.write(' <td style="width: 21px; height: 20px"><button><img src="images/toolbar/spellcheck.gif" style="width: 21px; height: 20px"></button></td>');
document.write(' <td style="width: 21px; height: 20px"><button><img src="images/toolbar/source.gif" style="width: 21px; height: 20px"></button></td>');
document.write('</tr>');
}
function action(what)
{
document.getElementById('editable').contentWindow.document.execCommand(''+what+'',false,null);
}
function createImage()
{
imagePath = prompt('Enter Image URL:', '
http://');
if ((imagePath != null) && (imagePath != ""))
{
document.getElementById('editable').contentWindow.document.execCommand('InsertImage', false, imagePath);
}
}
</script>
Min html del:
<body onLoad="startEditor()">
<table style="width: 100%; height: 100%" cellspacing="0" cellpadding="0">
<tr>
<td valign="middle" align="center">
<table style="width: 500px; height: 200px; border: 0px" cellspacing="0" cellpadding="0">
<tr>
<td>
<table style="height: 20px; border: 0px" cellspacing="0" cellpadding="0">
<script> toolbar(); </script>
</table>
</td>
</tr>
<tr>
<td style="width: 500px; height: 200px"><iFrame id="editable" class="editor" src="empty.htm"></iFrame></td>
</tr>
<tr>
<td style="width: 500px; height: 200px"><textarea name="content" id="content" style="display: none; width: 500px; height: 200px"></textarea></td>
</tr>
</table>
</td>
</tr>
</table>