/    Sign up×
Community /Pin to ProfileBookmark

I use the function below to view HTML source code in the WYSIWYG editor I’m putting together . But if the web page has a dark background image, I can’t read the HTML because the image appears as background to the source code!

I tried tacking (background=’hidden’) onto the innerText statement, but it doesn’t work.

Any ideas to get around this weird problem?

function doToggleView()
{

if(viewMode == 1)
{
iHTML = iView.document.body.innerHTML;
iView.document.body.innerText = iHTML;

viewMode = 2; // Code
}
else
{
iText = iView.document.body.innerText;
iView.document.body.innerHTML = iText;

viewMode = 1; // WYSIWYG
}

}

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@TageMar 30.2004 — I had a *little* trouble reenacting your script. I'm supposing iView refers to a frame(??)... And it wouldn't allow the iText and iHTML var's to work (beats me). Anyway, I was able to get it to work without the iView and getting rid of the middlemen... So you can add them back into my example or whatever... Click anywhere on the page to toggle the HTML on and off. Hope this helps... Later

[upl-file uuid=b6aff682-642a-496b-a8b5-1cf22e70d540 size=654B]togglehtml.zip[/upl-file]
Copy linkTweet thisAlerts:
@starrwriterauthorMar 31.2004 — [i]Originally posted by Tage [/i]

[B]I had a *little* trouble reenacting your script. I'm supposing iView refers to a frame(??)... And it wouldn't allow the iText and iHTML var's to work (beats me). Anyway, I was able to get it to work without the iView and getting rid of the middlemen... So you can add them back into my example or whatever... Click anywhere on the page to toggle the HTML on and off. Hope this helps... Later [/B][/QUOTE]


Didn't work. I even tried adding iView in front of the document statements, but no go.

This is for a toggle HTML/Visual button on a WYSIWYG editor I'm developing. The page background (whether colors or images in style or body) is displayed as background of the source code. iView is the iframe displayed in the editing window and it is in IE design mode.

Thanks for trying anyway.
Copy linkTweet thisAlerts:
@TageMar 31.2004 — weird, I don't have any more ideas, sorry! D= hope someone else can help you or you find it out.
×

Success!

Help @starrwriter spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...