Textarea Problem

Einklappen
X
 
  • Filter
  • Zeit
  • Anzeigen
Alles löschen
neue Beiträge

  • Textarea Problem

    Hallo,
    also ich habe folgendes Problem. Ich habe meine Textarea in einer .js File und Sie wird deshalb nicht übertragen wenn ich das Formular abschicke. Hier mal die Ausgabe Seite:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
    <title>Cross-Browser Rich Text Editor</title>
    
    <style type="text/css">
    .btnImage {cursor: pointer; cursor: hand;}
    </style>
    
    </head>
    <body>
    <form enctype="multipart/form-data" method=post action="../artikel.php?artikel_id=<? echo $artikel_id ?>&ok_id=<? echo $ok_id ?>&id=<? echo $id ?>">
    
    <iframe id="testFrame" style="position: absolute; visibility: hidden; width: 0px; height: 0px;"></iframe>
    <script language="JavaScript" type="text/javascript" src="browserdetect.js"></script>
    <script language="JavaScript" type="text/javascript" src="richtext.js"></script>
    <script language="JavaScript" type="text/javascript">
    <!--
    function submitForm() {
    	try {
    		alert(document.getElementById('edit').contentWindow.document.body.innerHTML);
    	}
    	catch (e) {
    		alert(document.getElementById('edit').value);
    	}
    }
    
    Start();
    //-->
    </script>
    <noscript><p><b>Javascript must be enabled to use this form.</b></p></noscript>
    
    <p>Click submit to show the value of the text box.</p>
    <p>
    <input type="hidden" name="action" value="insert">
    <input type="submit" name="doupload" value="Submit"></p>
    </form>
    </body>
    </html>
    Und hier die richtext.js:
    Code:
    <<<< weitere Funktionen >>>>
    function writeRTE() {
    	document.writeln('<table>');
    	document.writeln('	<tr>');
    	document.writeln('		<td>');
    	document.writeln('			<select id="formatblock" onchange="Select(this.id);">');
    	document.writeln('				<option value="<p>">Normal</option>');
    	document.writeln('				<option value="<p>">Paragraph</option>');
    	document.writeln('				<option value="<h1>">Heading 1 <h1></option>');
    	document.writeln('				<option value="<h2>">Heading 2 <h2></option>');
    	document.writeln('				<option value="<h3>">Heading 3 <h3></option>');
    	document.writeln('				<option value="<h4>">Heading 4 <h4></option>');
    	document.writeln('				<option value="<h5>">Heading 5 <h5></option>');
    	document.writeln('				<option value="<h6>">Heading 6 <h6></option>');
    	document.writeln('				<option value="<address>">Address <ADDR></option>');
    	document.writeln('				<option value="<pre>">Formatted <pre></option>');
    	document.writeln('			</select>');
    	document.writeln('		</td>');
    	document.writeln('		<td>');
    	document.writeln('			<select id="fontname" name="selectFont" onchange="Select(this.id)">');
    	document.writeln('				<option value="Font" selected>Font</option>');
    	document.writeln('				<option value="Arial, Helvetica, sans-serif">Arial</option>');
    	document.writeln('				<option value="Courier New, Courier, mono">Courier New</option>');
    	document.writeln('				<option value="Times New Roman, Times, serif">Times New Roman</option>');
    	document.writeln('				<option value="Verdana, Arial, Helvetica, sans-serif">Verdana</option>');
    	document.writeln('			</select>');
    	document.writeln('		</td>');
    	document.writeln('		<td>');
    	document.writeln('			<select unselectable="on" id="fontsize" onchange="Select(this.id);">');
    	document.writeln('				<option value="Size">Size</option>');
    	document.writeln('				<option value="1">1</option>');
    	document.writeln('				<option value="2">2</option>');
    	document.writeln('				<option value="3">3</option>');
    	document.writeln('				<option value="4">4</option>');
    	document.writeln('				<option value="5">5</option>');
    	document.writeln('				<option value="6">6</option>');
    	document.writeln('				<option value="7">7</option>');
    	document.writeln('			</select>');
    	document.writeln('		</td>');
    	document.writeln('	</tr>');
    	document.writeln('</table>');
    	document.writeln('<table cellpadding="1" cellspacing="0">');
    	document.writeln('	<tr>');
    	document.writeln('		<td><img class="btnImage" src="images/post_button_bold.gif" width="25" height="24" alt="Bold" title="Bold" onClick="FormatText(\'bold\', \'\')"></td>');
    	document.writeln('		<td><img class="btnImage" src="images/post_button_italic.gif" width="25" height="24" alt="Italic" title="Italic" onClick="FormatText(\'italic\', \'\')"></td>');
    	document.writeln('		<td><img class="btnImage" src="images/post_button_underline.gif" width="25" height="24" alt="Underline" title="Underline" onClick="FormatText(\'underline\', \'\')"></td>');
    	document.writeln('		<td>&nbsp;</td>');
    	document.writeln('		<td><img class="btnImage" src="images/post_button_left_just.gif" width="25" height="24" alt="Align Left" title="Align Left" onClick="FormatText(\'justifyleft\', \'\')"></td>');
    	document.writeln('		<td><img class="btnImage" src="images/post_button_centre.gif" width="25" height="24" alt="Center" title="Center" onClick="FormatText(\'justifycenter\', \'\')"></td>');
    	document.writeln('		<td><img class="btnImage" src="images/post_button_right_just.gif" width="25" height="24" alt="Align Right" title="Align Right" onClick="FormatText(\'justifyright\', \'\')"></td>');
    	document.writeln('		<td>&nbsp;</td>');
    	document.writeln('		<td><img class="btnImage" src="images/post_button_numbered_list.gif" width="25" height="24" alt="Ordered List" title="Ordered List" onClick="FormatText(\'insertorderedlist\', \'\')"></td>');
    	document.writeln('		<td><img class="btnImage" src="images/post_button_list.gif" width="25" height="24" alt="Unordered List" title="Unordered List" onClick="FormatText(\'insertunorderedlist\', \'\')"></td>');
    	document.writeln('		<td>&nbsp;</td>');
    	document.writeln('		<td><img class="btnImage" src="images/post_button_outdent.gif" width="25" height="24" alt="Outdent" title="Outdent" onClick="FormatText(\'outdent\', \'\')"></td>');
    	document.writeln('		<td><img class="btnImage" src="images/post_button_indent.gif" width="25" height="24" alt="Indent" title="Indent" onClick="FormatText(\'indent\', \'\')"></td>');
    	document.writeln('		<td><div id="forecolor"><img class="btnImage" src="images/post_button_textcolor.gif" width="25" height="24" alt="Text Color" title="Text Color" onClick="FormatText(\'forecolor\', \'\')"></div></td>');
    	document.writeln('<!--');
    	document.writeln('		<td><div id="hilitecolor"><img class="btnImage" src="images/post_button_bgcolor.gif" width="25" height="24" alt="Background Color" title="Background Color" onClick="FormatText(\'hilitecolor\', \'\')"></div></td>');
    	document.writeln('//-->');
    	document.writeln('		<td>&nbsp;</td>');
    	document.writeln('		<td><img class="btnImage" src="images/post_button_hyperlink.gif" width="25" height="24" alt="Insert Link" title="Insert Link" onClick="FormatText(\'createlink\')"></td>');
    	document.writeln('		<td><img class="btnImage" src="images/post_button_image.gif" width="25" height="24" alt="Add Image" title="Add Image" onClick="AddImage()"></td>');
    
    	if (browser.isIE5up) document.writeln('		<td><img class="btnImage" src="images/post_button_spellcheck.gif" width="25" height="24" alt="Add Image" title="Add Image" onClick="checkspell()"></td>');
    	document.writeln('<!--');
    	document.writeln('		<td>&nbsp;</td>');
    	document.writeln('		<td><img class="btnImage" src="images/post_button_cut.gif" width="25" height="24" alt="Cut" title="Cut" onClick="FormatText(\'cut\')"></td>');
    	document.writeln('		<td><img class="btnImage" src="images/post_button_copy.gif" width="25" height="24" alt="Copy" title="Copy" onClick="FormatText(\'copy\')"></td>');
    	document.writeln('		<td><img class="btnImage" src="images/post_button_paste.gif" width="25" height="24" alt="Paste" title="Paste" onClick="FormatText(\'paste\')"></td>');
    	document.writeln('		<td>&nbsp;</td>');
    	document.writeln('		<td><img class="btnImage" src="images/post_button_undo.gif" width="25" height="24" alt="Undo" title="Undo" onClick="FormatText(\'undo\')"></td>');
    	document.writeln('		<td><img class="btnImage" src="images/post_button_redo.gif" width="25" height="24" alt="Redo" title="Redo" onClick="FormatText(\'redo\')"></td>');
    	document.writeln('//-->');
    	document.writeln('	</tr>');
    	document.writeln('</table>');
    	document.writeln('<br>');
    	document.writeln('<iframe id="edit" width="510px" height="200px"></iframe>');
    	document.writeln('<iframe width="250" height="170" id="colorpalette" src="palette.htm" style="visibility:hidden; position: absolute; left: 0px; top: 0px;"></iframe>');
    	setTimeout("enableDesignMode()", 10);
    }
    
    function writeDefault() {
    	document.writeln('<textarea name="text" id="edit" style="width: 510px; height: 200px;"></textarea>');
    }
    
    function enableDesignMode() {
    	if (browser.isIE5up) {
    		frames.edit.document.designMode = "On";
    		//frames.edit.document.onmouseup = document.selection.clear;
    	}
    	else {
    		document.getElementById('edit').contentDocument.designMode = "on"
    	}
    }
    Kann mir jemand helfen?
    Mfg
    BenBay

  • #2
    Tag nochmal,
    also ich könnte die Textarea direkt ins Formular einbauen so das auch noch der Editior funktioniert, das sieht dann so aus:
    Code:
    <form enctype="multipart/form-data" method=post action="../artikel.php?artikel_id=<? echo $artikel_id ?>&ok_id=<? echo $ok_id ?>&id=<? echo $id ?>">
    
    <iframe id="testFrame" style="position: absolute; visibility: hidden; width: 0px; height: 0px;"></iframe>
    <script language="JavaScript" type="text/javascript" src="browserdetect.js"></script>
    <script language="JavaScript" type="text/javascript" src="richtext.js"></script>
    <script language="JavaScript" type="text/javascript">
    <!--
    function submitForm() {
    	try {
    		alert(document.getElementById('edit').contentWindow.document.body.innerHTML);
    	}
    	catch (e) {
    		alert(document.getElementById('edit').value);
    	}
    }
    
    Start();
    //-->
    </script>
    <noscript><p><b>Javascript must be enabled to use this form.</b></p></noscript>
    
    <p>Click submit to show the value of the text box.</p>
    <p>
    <script language="JavaScript" type="text/javascript">
    function writeDefault() {
    	document.writeln('<textarea name="text" id="edit" style="width: 510px; height: 200px;"></textarea>');
    }
    </script>
    <input type="hidden" name="action" value="insert">
    <input type="submit" name="doupload" value="Submit"></p>
    Er übergibt mir Áber immer noch nicht die Textarea weil er wahrscheinlich den Java Script befehl ignoriert.
    Mfg
    BenBay

    Kommentar


    • #3
      Original geschrieben von BenBay
      Tag nochmal,
      also ich könnte die Textarea direkt ins Formular einbauen so das auch noch der Editior funktioniert, das sieht dann so aus:
      Code:
      <script language="JavaScript" type="text/javascript">
      function writeDefault() {
      	document.writeln('<textarea name="text" id="edit" style="width: 510px; height: 200px;"></textarea>');
      }
      </script>
      <input type="hidden" name="action" value="insert">
      <input type="submit" name="doupload" value="Submit"></p>
      zuerst mal sehe ich an dieser stelle lediglich eine funktionsdefinition - wo aber ist der aufruf

      und zum zweiten, an der zeile
      Code:
      document.writeln('<textarea name="text" id="edit" style="width: 510px; height: 200px;"></textarea>');
      ist doch offensichtlich nichts, aber auch gar nichts dynamisch - welchen sinn macht es also, diese mit javascript ins dokument zu schreiben, anstatt sie direkt im html-code zu notieren?
      I don't believe in rebirth. Actually, I never did in my whole lives.

      Kommentar


      • #4
        Diesen Teil denn du gerade Zitiert hast, war vorher in der richtext.js!!! Denn habe ich lediglich rausgenommen in der Hoffnung das er mir jetzt den Inhalt der Textarea auch mit übergibt, tut er aber nicht.
        Mfg
        BenBay

        Kommentar


        • #5
          Hier mal der komplette Editor:
          Angehängte Dateien
          Mfg
          BenBay

          Kommentar

          Lädt...
          X