Danke erstmal für deine Mühe. Hab mich mal hingesetzt und mal ein bisschen mit den anderen Scripts gespielt. Das ist da herausgekommen.
[CODE]
<html>
<head>
<title>Änderungsmaske Neuigkeiten</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../style.css" rel="stylesheet" type="text/css">
<script language="JavaScript">
<!--
function SymError()
{
return true;
}
window.onerror = SymError;
var SymRealWinOpen = window.open;
function SymWinOpen(url, name, attributes)
{
return (new Object());
}
window.open = SymWinOpen;
//-->
</script>
<script language="JavaScript" type="text/JavaScript">
<!--
/*written by chris wetherell
http://www.massless.org
chris [THE AT SIGN] massless.org
warning: it only works for IE4+/Win and Moz1.1+
feel free to take it for your site
if there are any problems, let chris know.
*/
var thisForm; /* make sure to change the onload handler of the
<body> tag to the form you're using!... */
/* YOU CAN ERASE getMozSelection():
It's here for debug purposes only */
function getMozSelection(txtarea) {
var selLength = txtarea.textLength;
var selStart = txtarea.selectionStart;
var selEnd = txtarea.selectionEnd;
if (selEnd==1 || selEnd==2) selEnd=selLength;
return (txtarea.value).substring(selStart, selEnd);
}
function mozWrap(txtarea, lft, rgt) {
var selLength = txtarea.textLength;
var selStart = txtarea.selectionStart;
var selEnd = txtarea.selectionEnd;
if (selEnd==1 || selEnd==2) selEnd=selLength;
var s1 = (txtarea.value).substring(0,selStart);
var s2 = (txtarea.value).substring(selStart, selEnd)
var s3 = (txtarea.value).substring(selEnd, selLength);
txtarea.value = s1 + lft + s2 + rgt + s3;
}
function IEWrap(lft, rgt) {
strSelection = document.selection.createRange().text;
if (strSelection!="") {
document.selection.createRange().text = lft + strSelection + rgt;
}
}
function wrapSelection(txtarea, lft, rgt) {
if (document.all) {IEWrap(lft, rgt);}
else if (document.getElementById) {mozWrap(txtarea, lft, rgt);}
}
function wrapSelectionWithLink(txtarea) {
var my_link = prompt("Enter URL:","http://");
if (my_link != null) {
lft="<a href="" + my_link + "">";
rgt="</a>";
wrapSelection(txtarea, lft, rgt);
}
return;
}
document.onkeypress = function (e) {
if (document.all) {
key=event.keyCode; txtarea=thisForm.textfeld;
if (key == 1) wrapSelectionWithLink(txtarea);
if (key == 2) wrapSelection(txtarea,'<b>','</b>');
if (key == 20) wrapSelection(txtarea,'<i>','</i>');
}
else if (document.getElementById) {
ctrl=e.ctrlKey; shft=e.shiftKey; chr=e.charCode;
if (ctrl) if (shft) if (chr==65) wrapSelectionWithLink(thisForm.textfeld);
if (ctrl) if (shft) if (chr==66) wrapSelection(thisForm.textfeld,'<b>','</b>');
if (ctrl) if (shft) if (chr==84) wrapSelection(thisForm.textfeld,'<i>','</i>');
}
return true;
}
/* end chris w. script */
/*
written by meg hourihan
http://www.megnut.com
meg@megnut.com
warning: it only works for IE4+/Win and Moz1.1+
feel free to take it for your site
but leave this text in place.
any problems, let meg know.
*/
function mouseover(el) {
el.className = "raise";
}
function mouseout(el) {
el.className = "buttons";
}
function mousedown(el) {
el.className = "press";
}
function mouseup(el) {
el.className = "raise";
}
/* end meg script */
// -->
//-->
</script>
<style type="text/css">
<!--
.buttons {
background: #ccc;
border: 1px solid #ccc;
margin: 1;
float:left;
}
.raise {
border-top: 1px solid buttonhighlight;
border-left: 1px solid buttonhighlight;
border-bottom: 1px solid buttonshadow;
border-right: 1px solid buttonshadow;
background: #ccc;
margin:1;
float:left;
}
.press {
border-top: 1px solid buttonshadow;
border-left: 1px solid buttonshadow;
border-bottom: 1px solid buttonhighlight;
border-right: 1px solid buttonhighlight;
background: #ccc;
margin:1;
float:left;
}
#toolbar {
margin: 0;
width: 153px;
padding: 0;
height:20px;
background: #ccc;
border-top: 1px solid buttonhighlight;
border-left: 1px solid buttonhighlight;
border-bottom: 1px solid buttonshadow;
border-right: 1px solid buttonshadow;
text-align:left;
}
-->
</style>
</head>
<body onload="var SymTmpWinOpen = window.open; window.open = SymWinOpen; thisForm=document.forma;; window.open = SymTmpWinOpen;">
<form action="script.php" method="post" enctype="multipart/form-data" name="forma" id="forma">
<p class="ueberschrift1">Änderungsmaske</p>
<table width="700" border="0" cellspacing="0" cellpadding="5">
<tr align="left" valign="top">
<td width="680"><span class="text">Beschreibender Text</span><span class="ueberschrift3">
</span> <div id="toolbar"><img class="buttons" onMouseOver="mouseover(this);" onMouseOut="mouseout(this);"
onMouseDown="mousedown(this);" onMouseUp="mouseup(this);"
onClick="wrapSelection(thisForm.textfeld,'<b>','</b>');" src="bold.gif"
title="Hier klicken um den markierten Text fett zu machen"> <img class="buttons" onMouseOver="mouseover(this);" onMouseOut="mouseout(this);"
onMouseDown="mousedown(this);" onMouseUp="mouseup(this);"
onClick="wrapSelection(thisForm.textfeld,'<i>','</i>');" src="italic.gif"
title="Hier klicken um den markierten Text schräg zu stellen"> <img class="buttons" onMouseOver="mouseover(this);" onMouseOut="mouseout(this);"
onMouseDown="mousedown(this);" onMouseUp="mouseup(this);"
onClick="wrapSelection(thisForm.textfeld,'<strong><font color=#FF0000>','</font></strong>');" src="redbold.gif"
title="Hier klicken um den markierten Text rot und dick zu verändern">
<img class="buttons" onMouseOver="mouseover(this);" onMouseOut="mouseout(this);"
onMouseDown="mousedown(this);" onMouseUp="mouseup(this);"
onClick="wrapSelectionWithLink(thisForm.textfeld);" src="link.gif" width=32 height=16 align="middle"
title="Hier klicken um einen Hyperlink aus dem markierten Text zu machen">
</div>
<p> <span class="ueberschrift3">
<textarea name="textfeld" id="textarea5" cols="80" rows="10"></textarea>
</span></p></td>
</tr>
</table>
</form>
</body>
</html>
[CODE]
Das kann man noch prima ausbauen...
viel spaß
chris_xn