The forums have permanently moved to forum.kirupa.com. This forum will be kept around in read-only mode for archival purposes. To learn how to continue using your existing account on the new forums, check out this thread.


Results 1 to 5 of 5

Thread: Need help with building simple editor

  1. #1
    6
    posts
    The only one planned for.

    Need help with building simple editor

    I have just the basic skill of PHP and Javascript(Still not vary good at), and MySQL. I am trying to learn a bit about editing the "innerHTML" of a span tag. I saw a lot about it in the Ajax edit in place but that isn't what I am looking for. I don't know how to call the content to a text box for editing though and even then I still don't know what to do after that so I REALLY need some direction here of I might just ruin something.

    Thank-you.

  2. #2
    Okay, so if I have read this right you want to....

    Get the content of a span in the HTML and insert the content of that span into a text box as a value? Would this happen on page load or does something trigger it?

  3. #3
    This is for a quick edit phpbb mod I'm working on:

    Code:
    function openEditor(){
    	if(document.getElementById('inlineEditBox') != null){
    		alert('You must first finish editing your other post.');
    	}
    	else{
    		f = document.getElementById('postDiv').innerHTML;
    		f = "<textarea id='inlineEditBox' class='inputbox' rows='8'>" + f + 
    				"</textarea><br /><input type='button' value='Submit' onClick='commit("+pid+")' />";
    		document.getElementById('post_' + id).innerHTML = f;
    	}
    }
    Basically, you use innerHTML to get the contents, then you make innerHTML equal to the old html, wraped in textarea tags.

  4. #4
    6
    posts
    The only one planned for.

    Sorry for taking so long.

    Quote Originally Posted by evildrummer View Post
    Okay, so if I have read this right you want to....

    Get the content of a span in the HTML and insert the content of that span into a text box as a value? Would this happen on page load or does something trigger it?
    There will be a small button to trigger it in the right hand corner of the element. I am going to make it only show up if the user has the ability to edit the page, otherwise it won't even exist on the viewing side.

  5. #5
    6
    posts
    The only one planned for.
    Quote Originally Posted by blazes View Post
    This is for a quick edit phpbb mod I'm working on:

    Code:
    function openEditor(){
        if(document.getElementById('inlineEditBox') != null){
            alert('You must first finish editing your other post.');
        }
        else{
            f = document.getElementById('postDiv').innerHTML;
            f = "<textarea id='inlineEditBox' class='inputbox' rows='8'>" + f + 
                    "</textarea><br /><input type='button' value='Submit' onClick='commit("+pid+")' />";
            document.getElementById('post_' + id).innerHTML = f;
        }
    }
    Basically, you use innerHTML to get the contents, then you make innerHTML equal to the old html, wraped in textarea tags.
    That is basically what I want but I'll need to make a version of my own. This my be a while.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012