SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Evangelist cturner01's Avatar
    Join Date
    Jun 2006
    Location
    My computer
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Editing the iframe?

    I am wanting to edit an article that is on a database. I want the article to appear in an iframe, that is working. However when I click on the iframe I can't edit the article. I can only delete the whole article and then type. Is there a way to edit the article in the iframe without deleting the whole article? Thanks in advance.

    This the code that I am working with:
    Code:
    <iframe id="texteditor" name="texteditor" width="600" height="300" src="http://www.blueguminteractive.biz/myrte/phppage.php"></iframe>
    Code JavaScript:
    var texteditor = document.getElementById('texteditor');
    texteditor.document.body.contentEditable = true;	
    texteditor.document.designMode = 'On';
    texteditor.document.open();
    //texteditor.document.writeln( var content = "<?php //echo $article; ?>"; );
    texteditor.document.close();
     
    function fontEdit(x,y)
    {
       texteditor.document.execCommand(x,"",y);
       texteditor.focus();
    }
     
    function AddLink()
    {//Identify selected text
    var sText = document.selection.createRange();
    if (!sText==""){
        //Create link
         document.execCommand("CreateLink");
         //Replace text with URL
         if (sText.parentElement().tagName == "A"){
           sText.parentElement().innerText=sText.parentElement().href;
           document.execCommand("ForeColor","false","#FF0033");
         }    
      }
    }
     
    function AddLink2() {
    var sText = document.selection.createRange();
    if (!sText==""){
        //Create link
         document.execCommand("CreateLink");
         //Replace text with email
         if (sText.parentElement().tagName == "A"){
           sText.parentElement().innerText=sText.parentElement().href;
           document.execCommand("ForeColor","false","#FF0033");
         }    
      }
    }

  2. #2
    SitePoint Evangelist cturner01's Avatar
    Join Date
    Jun 2006
    Location
    My computer
    Posts
    408
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    There has been 41 views of this page so surely someone knows the answer to my problem. Anyone?


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •