Avatar billede izemate Nybegynder
26. maj 2003 - 21:47 Der er 14 kommentarer og
1 løsning

Dhtml Editor Gem ?

Jeg har en editor (som jeg har herfra exp.dk)
den kan ses her
http://www.cafecc.dk/editor.txt

Det skal IKKE sælges vider men kun bruges til privat forbrug..
Det skal køre over asp via en access database..

Jeg søger nu at man kan trykke på et side navn ex Forside.
Så skal jeg komme til editoren hvor inholdet fra databasen Forside > Inhold bliver vist i Editoren

Så skal man kunne redigere det og gemme det så det for samme placering uden at oprette en ny kolonne..

På forhånd tak :-)
<\\izemate
Avatar billede bobbedude Nybegynder
27. maj 2003 - 07:23 #1
Hey izemate, jeg tror godt jeg kan hjælpe dig.
Hvis det er ok med dig så vis lige koden ellers bliver det lidt svært.
Ps. jeg har lavet en du kan se på www.wild-game.dk hvis du trykker på gæstebog.
Avatar billede izemate Nybegynder
27. maj 2003 - 09:23 #2
Du kan bare trykke "vis kilde" på det link foroven..
Hvis ikke så kan jeg sende det til din e-mail hvis du alså har en ;-)
Avatar billede bobbedude Nybegynder
27. maj 2003 - 10:06 #3
sporgejorgen@hotmail.com
Avatar billede bobbedude Nybegynder
27. maj 2003 - 10:57 #4
oki så virker det

---------- default.asp ----------

<html>

<link REL="stylesheet" TYPE="text/css" HREF="style.css">


<script LANGUAGE="JavaScript">
function button_over(eButton)
    {
    eButton.style.backgroundColor = "#B5BDD6";
    eButton.style.borderColor = "darkblue darkblue darkblue darkblue";
    }
function button_out(eButton)
    {
    eButton.style.backgroundColor = "threedface";
    eButton.style.borderColor = "threedface";
    }
function button_down(eButton)
    {
    eButton.style.backgroundColor = "#8494B5";
    eButton.style.borderColor = "darkblue darkblue darkblue darkblue";
    }
function button_up(eButton)
    {
    eButton.style.backgroundColor = "#B5BDD6";
    eButton.style.borderColor = "darkblue darkblue darkblue darkblue";
    eButton = null;
    }
//~~~~~~~~~~~~~~~~~~~~~~~~ Menu funktioner ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

var isHTMLMode=false

function document.onreadystatechange()
    {
      message.document.designMode="On"
    }
function cmdExec(cmd,opt)
    {
      if (isHTMLMode){alert("Please uncheck 'Edit HTML'");return;}
      message.document.execCommand(cmd,"",opt);message.focus();
    }
function setMode(bMode)
    {
    var sTmp;
      isHTMLMode = bMode;
      if (isHTMLMode){sTmp=message.document.body.innerHTML;message.document.body.innerText=sTmp;}
    else {sTmp=message.document.body.innerText;message.document.body.innerHTML=sTmp;}
      message.focus();
    }
function createLink()
    {
    if (isHTMLMode){alert("Please uncheck 'Edit HTML'");return;}
    cmdExec("CreateLink");
    }
function insertImage()
    {
    if (isHTMLMode){alert("Please uncheck 'Edit HTML'");return;}
    var sImgSrc=prompt("Insert Image File (You can use your local image file) : ", "http://www.aspalliance.com/Yusuf/sample.jpg");
    if(sImgSrc!=null) cmdExec("InsertImage",sImgSrc);
    }
function Save()
    {
    if (isHTMLMode){alert("Please uncheck 'Edit HTML'");return;}
      var sImgTag = message.document.body.all.tags("IMG");
      var oImg;
      for (var i = sImgTag.length - 1; i >= 0; i--)
        {
        oImg = sImgTag[i];
        alert("Add your code to Upload Local Image file here. Image inserted : " + oImg.src );
          }
      alert("Add your code to Save Document here");
      alert("Your Document : " + message.document.body.innerHTML);
    }
function foreColor()
{
    var arr = showModalDialog("selcolor.htm","","font-family:Verdana; font-size:12; dialogWidth:30em; dialogHeight:34em" );
    if (arr != null) cmdExec("ForeColor",arr);   
    }

function flytindhold()
{
  document.frm.html.value = message.document.body.innerHTML;
  document.frm.submit();
}
   
   
</script>

<TABLE bgcolor="#f0f8ff" style="BORDER-BOTTOM: darkblue 1px solid; BORDER-LEFT: darkblue 1px solid; BORDER-RIGHT: darkblue 1px solid; BORDER-TOP: darkblue 1px solid; FONT-FAMILY: verdana"

<table id="tblCoolbar" width="502" cellpadding="0" cellspacing="0">
<tr valign="middle">

    <td colspan="16">
                <select onchange="cmdExec('fontname',this[this.selectedIndex].value);">
            <option selected>Font</option>
            <option value="Arial">Arial</option>
            <option value="Arial Black">Arial Black</option>
            <option value="Arial Narrow">Arial Narrow</option>
            <option value="Comic Sans MS">Comic Sans MS</option>
            <option value="Courier New">Courier New</option>
            <option value="System">System</option>
            <option value="Tahoma">Tahoma</option>
            <option value="Times New Roman">Times New Roman</option>
            <option value="Verdana">Verdana</option>
            <option value="Wingdings">Wingdings</option>
        </select>
        <select onchange="cmdExec('fontsize',this[this.selectedIndex].value);">
            <option selected>Size</option>
            <option value="1">1</option>
            <option value="2">2</option>
            <option value="3">3</option>
            <option value="4">4</option>
            <option value="5">5</option>
            <option value="6">6</option>
            <option value="7">7</option>
            <option value="8">8</option>
            <option value="10">10</option>
            <option value="12">12</option>
            <option value="14">14</option>
        </select>
       
    </td>
   
</tr>
<tr>

    <td><div class="cbtn" onClick="cmdExec('cut')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
    <img hspace="1" vspace="1" align="absmiddle" src="images/Cut.gif" alt="Cut" WIDTH="23" HEIGHT="22">
    </div></td>
   
    <td><div class="cbtn" onClick="cmdExec('copy')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
    <img hspace="1" vspace="1" align="absmiddle" src="images/Copy.gif" alt="Copy" WIDTH="23" HEIGHT="22">
    </div></td>   
   
    <td><div class="cbtn" onClick="cmdExec('paste')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
    <img hspace="1" vspace="1" align="absmiddle" src="images/Paste.gif" alt="Paste" WIDTH="23" HEIGHT="22">
    </div></td>   
   
    <td><div class="cbtn" onClick="cmdExec('bold')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
    <img hspace="1" vspace="1" align="absmiddle" src="images/Bold.gif" alt="Bold" WIDTH="23" HEIGHT="22">
    </div></td>
   
    <td><div class="cbtn" onClick="cmdExec('italic')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
    <img hspace="1" vspace="1" align="absmiddle" src="images/Italic.gif" alt="Italic" WIDTH="23" HEIGHT="22">
    </div></td>   
   
    <td><div class="cbtn" onClick="cmdExec('underline')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
    <img hspace="1" vspace="1" align="absmiddle" src="images/Under.gif" alt="Underline" WIDTH="23" HEIGHT="22">
    </div></td>       
       
    <td><div class="cbtn" onClick="cmdExec('justifyleft')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
    <img hspace="1" vspace="1" align="absmiddle" src="images/Left.gif" alt="Justify Left" WIDTH="23" HEIGHT="22">
    </div></td>
   
    <td><div class="cbtn" onClick="cmdExec('justifycenter')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
    <img hspace="1" vspace="1" align="absmiddle" src="images/Center.gif" alt="Center" WIDTH="23" HEIGHT="22">
    </div></td>   
   
    <td><div class="cbtn" onClick="cmdExec('justifyright')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
    <img hspace="1" vspace="1" align="absmiddle" src="images/Right.gif" alt="Justify Right" WIDTH="23" HEIGHT="22">
    </div></td>       
   
    <td><div class="cbtn" onClick="cmdExec('insertorderedlist')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
    <img hspace="2" vspace="1" align="absmiddle" src="images/numlist.GIF" alt="Ordered List" WIDTH="23" HEIGHT="22">
    </div></td>   

    <td><div class="cbtn" onClick="cmdExec('insertunorderedlist')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
    <img hspace="2" vspace="1" align="absmiddle" src="images/bullist.GIF" alt="Unordered List" WIDTH="23" HEIGHT="22">
    </div></td>
       
    <td><div class="cbtn" onClick="cmdExec('outdent')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
    <img hspace="2" vspace="1" align="absmiddle" src="images/deindent.gif" alt="Decrease Indent" WIDTH="23" HEIGHT="22">
    </div></td>   
   
    <td><div class="cbtn" onClick="cmdExec('indent')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
    <img hspace="2" vspace="1" align="absmiddle" src="images/inindent.gif" alt="Increase Indent" WIDTH="23" HEIGHT="22">
    </div></td>           
   
    <td><div class="cbtn" onClick="foreColor()" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
    <img hspace="2" vspace="1" align="absmiddle" src="images/fgcolor.gif" alt="Forecolor" WIDTH="23" HEIGHT="22">
    </div></td>           

    <td><div class="cbtn" onClick="cmdExec('createLink')" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
    <img hspace="2" vspace="1" align="absmiddle" src="images/Link.gif" alt="Link" WIDTH="23" HEIGHT="22">
    </div></td>   
   
    <td><div class="cbtn" onClick="insertImage()" onmouseover="button_over(this);" onmouseout="button_out(this);" onmousedown="button_down(this);" onmouseup="button_up(this);">
    <img hspace="2" vspace="1" align="absmiddle" src="images/Image.gif" alt="Image" WIDTH="23" HEIGHT="22">
    </div></td>       
   
       
    <td width="20">&nbsp;</td>   
   
</tr>
</table>
</form>

<form action="save.asp?mode=write" method="post" name="frm">
<iframe width="502" id="message" height="150"></iframe>
<br>


<input type="hidden" name="message" value="">

<input type="checkbox" onclick="setMode(this.checked)"> <font face="verdana" size="2"> Vis HTML</font>
        <p>
       
  <input name="Submit" type="submit" class="button" tabindex="30" OnClick="document.frm.message.value = frames.message.document.body.innerHTML;" value="  Send  ">     
</p>
  <p>

  </p>


</form>
</td>
</tr>
</table>
</body>
</html>


---------- save.asp -----------

<%
If request.querystring("mode")="write" then
    response.write request.form("message")
    response.write "test"
end if
%>





Fejlen var at <form var placeret forkert og at der var fyldt noget i den skjulte form.
Avatar billede bobbedude Nybegynder
27. maj 2003 - 10:58 #5
Rettelse

---------- save.asp -----------

<%
If request.querystring("mode")="write" then
    response.write request.form("message")
'her kan du placer den funktion der skal gemme indholdet i databasen
end if
%>
Avatar billede bobbedude Nybegynder
27. maj 2003 - 11:05 #6
Du burde nok rette <iframe width="502" id="message" height="150"></iframe>
til <iframe src="IE_textbox.asp" width="502" id="message" height="150"></iframe>

Du skal så nok have en blank side der hedder IE_textbox.asp

Nu kan du kan du hente ting ind på IE_textbox.asp via ID eks.

IE_textbox.asp?ID=<%=request.querystring("ID")%>
Avatar billede izemate Nybegynder
27. maj 2003 - 12:33 #7
Er det for krævende hvis jeg spurgte om du ville lave et eksempel alså med database (access) ??

<\\Izemate
Avatar billede bobbedude Nybegynder
27. maj 2003 - 13:30 #8
næ nej men jeg vil gerne vide hvilke sider du vil kunne rette og også gerne vide hvad dine tabeller og rækker hedder i din database.
Avatar billede bobbedude Nybegynder
27. maj 2003 - 13:31 #9
Ups jeg så ikke du havde skrevet eksempel, jeg laver et og sender den til din mail, har du en email adresse jeg kan bruge ?
Avatar billede izemate Nybegynder
27. maj 2003 - 14:10 #10
Uha det lyder godt... :-)
Ang database er det som jeg har skrevet...
Alså Forside > Indhold :)
du kan sende det til gfx@filmnet.dk
Avatar billede bobbedude Nybegynder
27. maj 2003 - 14:20 #11
jeg har sendt den med den adresse du sendt til da du sendte den første fil til mig :ø))
Avatar billede Slettet bruger
27. maj 2003 - 14:27 #12
Bemærk:
Alle svar skal være tilgængelige for alle på Eksperten.
Avatar billede bobbedude Nybegynder
27. maj 2003 - 14:39 #13
jaja men man kan altså ikke vedhæfte en database til et svar vel ?? og som du ser længere oppe har jeg faktisk postet svaret ik ?
Avatar billede cozey Nybegynder
27. maj 2003 - 20:01 #14
Hva' så Izemate? ... lang tid siden :O) ...
Avatar billede izemate Nybegynder
28. maj 2003 - 10:56 #15
Bobbedude her er dine fuldt ud fortjene point !!
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Kurser inden for grundlæggende programmering

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester