S
Simon Rigby
Hi folks,
I'm trying to switch an iFrame in and out of design mode by way of a
script. As you can see from the method it is intended to be cross
browser compatible (or FF and IE at least). The FF version (the else
branch) works fine but the if branch (IE) switches into design Mode but
wont switch back.
Below is my method, the iFrame tages and the anchor used to trigger the
function call. Any help greatly appreciated.
--- Method ---
function ToggleEditMode(element) {
if (document.all) {
if (frames[element].document.designMode == "on") {
frames[element].document.designMode = "off";
} else {
frames[element].document.designMode = "on";
}
} else {
if
(document.getElementById(element).contentDocument.designMode=="on") {
document.getElementById(element).contentDocument.designMode="off";
} else {
document.getElementById(element).contentDocument.designMode="on";
}
}
return;
}
--- iFrame ---
<iframe name="edit" id="edit" WIDTH="512" HEIGHT="214"
CONTENTEDITABLE="True"></iframe>
--- anchor ---
<a href="javascript:ToggleEditMode('edit')">Edit</a>
Thanks
I'm trying to switch an iFrame in and out of design mode by way of a
script. As you can see from the method it is intended to be cross
browser compatible (or FF and IE at least). The FF version (the else
branch) works fine but the if branch (IE) switches into design Mode but
wont switch back.
Below is my method, the iFrame tages and the anchor used to trigger the
function call. Any help greatly appreciated.
--- Method ---
function ToggleEditMode(element) {
if (document.all) {
if (frames[element].document.designMode == "on") {
frames[element].document.designMode = "off";
} else {
frames[element].document.designMode = "on";
}
} else {
if
(document.getElementById(element).contentDocument.designMode=="on") {
document.getElementById(element).contentDocument.designMode="off";
} else {
document.getElementById(element).contentDocument.designMode="on";
}
}
return;
}
--- iFrame ---
<iframe name="edit" id="edit" WIDTH="512" HEIGHT="214"
CONTENTEDITABLE="True"></iframe>
--- anchor ---
<a href="javascript:ToggleEditMode('edit')">Edit</a>
Thanks