Kan ikke sætte en standard værdi for HMTL Editor
Jeg har fundet en HTML editor som jeg gerne vil bruge til min hjemmeside.Problemet er at jeg ikke kan få den til at beholde den tekst jeg skriver, når jeg trykker gem (så ryger hele ideen ligesom).
Er der nogen der kan hjælpe?
Jeg har fundet menuen her:
http://www.insidedhtml.com/tips/contents/ts12/page1.asp
Og her er support fra Microsoft
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/commandids.asp
Koden for siden er her:
-----------------------------------------------------------
<!-- http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/commandids.asp -->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<SCRIPT>
// Set the focus to the editor
function setFocus() {
textEdit.focus()
}
function copyValue(f) {
f.elements.EditorValue.value = "" + myEditor.document.body.innerHTML + "";
}
// Initialize the editor with an empty document
function initEditor() {
textEdit.document.designMode="On"
textEdit.document.open()
textEdit.document.write("")
textEdit.document.close()
textEdit.focus()
}
window.onload = initEditor
</SCRIPT>
</HEAD>
<BODY>
<FORM ONSUBMIT="copyValue(this);" action="html.php" method="post">
<IFRAME ID=textEdit WIDTH=400 HEIGHT=200></IFRAME>
<TEXTAREA NAME=textEditValue></TEXTAREA>
<SCRIPT>
frames.myEditor.document.designMode = "On"
function makeBold() {
var tr = frames.textEdit.document.selection.createRange()
tr.execCommand("Bold")
tr.select()
frames.myEditor.focus()
}
function makeItalic() {
var tr = frames.textEdit.document.selection.createRange()
tr.execCommand("Italic")
tr.select()
frames.myEditor.focus()
}
function makeDelete() {
var tr = frames.textEdit.document.selection.createRange()
tr.execCommand("Delete")
tr.select()
frames.myEditor.focus()
}
function makeCreateLink() {
var tr = frames.textEdit.document.selection.createRange()
tr.execCommand("CreateLink")
tr.select()
frames.myEditor.focus()
}
</SCRIPT>
<br>
<INPUT TYPE="button" ONCLICK="makeBold()" VALUE="Bold"><br>
<INPUT TYPE="button" ONCLICK="makeDelete()" VALUE="Delete"><br>
<INPUT TYPE="button" ONCLICK="makeCreateLink()" VALUE="Link"><br>
<INPUT TYPE="submit" VALUE="Submit">
</FORM>
</BODY>
</HTML>
-----------------------------------------------------------
