Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
get element by - issue
Old 08-30-2011, 12:39 AM get element by - issue
Junior Talker

Posts: 1
Trades: 0
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

madscr2kl is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-30-2011, 09:43 AM Re: get element by - issue
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,383
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
To use the name attribute of html elements use the dotted class property convention

document.textbox.ContentWindow.focus()
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to get element by - issue
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.47060 seconds with 12 queries