get element by – issue

this is how i call the editor:

Code:

    <!-- editor -->
    <? include "js/editor/buttons.php"; ?>
    <iframe id="textbox" class="Eddietor" src="js/editor/editor.php"></iframe><br />
    <input type="hidden" id="content" name="content">
    <!-- /editor -->


and this is editor.js:

Code:

window.onload = function()
{
    Editor = document.getElementById('textbox').contentWindow.document;
    Editor.designMode = "on";
    document.forms[0].onsubmit = function()
    {
        var text = document.getElementById('text');
        text.value = Editor.body.innerHTML;
    }
}

function doColor(colour)
{
    document.getElementById("textbox").contentWindow.focus();
    document.getElementById("textbox").contentWindow.document.execCommand("forecolor",false, colour);
}

function doClick(command) {
document.getElementById("textbox").contentWindow.focus();
document.getElementById("textbox").contentWindow.document.execCommand(command, false, null);
}
function doLink() {
var mylink = prompt("URL:", "");
if ((mylink != null) && (mylink != "")) {
document.getElementById("textbox").contentWindow.focus();
document.getElementById('textbox').contentWindow.document.execCommand("CreateLink",false,mylink);
}
}
function doImage() {
myimg = prompt('URL:', '');
document.getElementById("textbox").contentWindow.focus();
document.getElementById('textbox').contentWindow.document.execCommand("InsertImage", false, myimg);
}


another script i made is having problems with the ID="textbox" , it might be fixed if i change id and start using name="textbox" instead,
but i don’t know how to do this in js. need to edit the editor.js and change id="textbox"->to->name="textbox"
can anyone help me? i got no idea how to use the getElementByName thingie , i’m trying to do this for 4 hours already and still no go.

appreciated

View full post on Tycoon Talk

,

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Get Adobe Flash playerPlugin by wpburn.com wordpress themes


RSS Site FeedRSS Site Feed

© 1992-2011 DC2NET™, Inc. All Rights Reserved