Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > How to load a page from file in browser using javascript

Reply
Thread Tools

How to load a page from file in browser using javascript

 
 
anonieko@hotmail.com
Guest
Posts: n/a
 
      02-25-2005
> Use x = window.Open(...) x.document.write( yourhtml)
> How to print from javascript using .print
> How to use ContentWindow
>
> How t use getElementById
> How to get HTML of document using document.body.innerHTML



// mail.js
var viewMode = 1; // WYSIWYG

function Init()
{
iView.document.designMode = 'On';
}

function selOn(ctrl)
{
ctrl.style.borderColor = '#000000';
ctrl.style.backgroundColor = '#B5BED6';
ctrl.style.cursor = 'hand';
}

function selOff(ctrl)
{
ctrl.style.borderColor = '#D6D3CE';
ctrl.style.backgroundColor = '#D6D3CE';
}

function selDown(ctrl)
{
ctrl.style.backgroundColor = '#8492B5';
}

function selUp(ctrl)
{
ctrl.style.backgroundColor = '#B5BED6';
}

function doBold()
{
iView.document.execCommand('bold', false, null);
}

function doItalic()
{
iView.document.execCommand('italic', false, null);
}

function doUnderline()
{
iView.document.execCommand('underline', false, null);
}

function doLeft()
{
iView.document.execCommand('justifyleft', false, null);
}

function doCenter()
{
iView.document.execCommand('justifycenter', false, null);
}

function doRight()
{
iView.document.execCommand('justifyright', false, null);
}

function doOrdList()
{
iView.document.execCommand('insertorderedlist', false, null);
}

function doBulList()
{
iView.document.execCommand('insertunorderedlist', false, null);
}

function doForeCol()
{
var fCol = prompt('Enter foreground color', '');

if(fCol != null)
iView.document.execCommand('forecolor', false, fCol);
}

function doBackCol()
{
var bCol = prompt('Enter background color', '');

if(bCol != null)
iView.document.execCommand('backcolor', false, bCol);
}

function doLink()
{
iView.document.execCommand('createlink');
}

function doImage()
{
var imgSrc = prompt('Enter image location', '');

if(imgSrc != null)
iView.document.execCommand('insertimage', false, imgSrc);
}

function doRule()
{
iView.document.execCommand('inserthorizontalrule', false, null);
}

function doFont(fName)
{
if(fName != '')
iView.document.execCommand('fontname', false, fName);
}

function doSize(fSize)
{
if(fSize != '')
iView.document.execCommand('fontsize', false, fSize);
}

function doHead(hType)
{
if(hType != '')
{
iView.document.execCommand('formatblock', false, hType);
doFont(selFont.options[selFont.selectedIndex].value);
}
}

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

// Hide all controls
tblCtrls.style.display = 'none';
selFont.style.display = 'none';
selSize.style.display = 'none';
selHeading.style.display = 'none';
iView.focus();

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

// Show all controls
tblCtrls.style.display = 'inline';
selFont.style.display = 'inline';
selSize.style.display = 'inline';
selHeading.style.display = 'inline';
iView.focus();

viewMode = 1; // WYSIWYG
}
}

function Send(form) {
var iframeID = document.getElementById("iView");
var middlebody = null;
if (iframeID==null) {
alert=("iFrame is NULL");
} else {
middlebody = iView.document.body.innerHTML;
}
var body = document.getElementById("upperMail").innerHTML + middlebody
+ document.getElementById("lowerMail").innerHTML;

for ( i=0; i < document.siteManagerForm.elements.length; ++i) {
if ( document.siteManagerForm.elements[i].type == "hidden" ) {
if ( document.siteManagerForm.elements[i].name == "mailContent"
) {
document.siteManagerForm.elements[i].value = body;
break;
}
}
}
form.submit();
}

function Preview(form) {
var title = "<head><title>Letter Preview</title></head>";
var closeButton = "<input type=button value=close
onclick='window.close()'>";
var line = "<hr border=\"1\" height=\"1px\" color=\"dee1f3\"/>"

var middlebody = null;

var iframeID = document.getElementById("iView");
if (iframeID==null) {
alert=("Warning: iFrame is NULL");
} else {
middlebody = iView.document.body.innerHTML;
}
var body = document.getElementById("upperMail").innerHTML + middlebody
+ document.getElementById("lowerMail").innerHTML;
var header = title+closeButton+line;
var footer = line+closeButton;
x=window.open("", "preview", "width=750, height=800, left=0, top=0,
menubar=no, status=no, location=no, toolbar=no, scrollbars=yes,
resizable=yes");
x.document.write(header + body + footer);
return false;
}

function Print() {
document.getElementById("iView").contentWindow.pri nt();
}

 
Reply With Quote
 
 
 
 
pinckyg@gmail.com
Guest
Posts: n/a
 
      02-26-2005

http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> > Use x = window.Open(...) x.document.write( yourhtml)
> > How to print from javascript using .print
> > How to use ContentWindow
> >
> > How t use getElementById
> > How to get HTML of document using document.body.innerHTML

>
>
> // mail.js
> var viewMode = 1; // WYSIWYG
>
> function Init()
> {
> iView.document.designMode = 'On';
> }
>
> function selOn(ctrl)
> {
> ctrl.style.borderColor = '#000000';
> ctrl.style.backgroundColor = '#B5BED6';
> ctrl.style.cursor = 'hand';
> }
>
> function selOff(ctrl)
> {
> ctrl.style.borderColor = '#D6D3CE';
> ctrl.style.backgroundColor = '#D6D3CE';
> }
>
> function selDown(ctrl)
> {
> ctrl.style.backgroundColor = '#8492B5';
> }
>
> function selUp(ctrl)
> {
> ctrl.style.backgroundColor = '#B5BED6';
> }
>
> function doBold()
> {
> iView.document.execCommand('bold', false, null);
> }
>
> function doItalic()
> {
> iView.document.execCommand('italic', false, null);
> }
>
> function doUnderline()
> {
> iView.document.execCommand('underline', false, null);
> }
>
> function doLeft()
> {
> iView.document.execCommand('justifyleft', false, null);
> }
>
> function doCenter()
> {
> iView.document.execCommand('justifycenter', false, null);
> }
>
> function doRight()
> {
> iView.document.execCommand('justifyright', false, null);
> }
>
> function doOrdList()
> {
> iView.document.execCommand('insertorderedlist', false, null);
> }
>
> function doBulList()
> {
> iView.document.execCommand('insertunorderedlist', false, null);
> }
>
> function doForeCol()
> {
> var fCol = prompt('Enter foreground color', '');
>
> if(fCol != null)
> iView.document.execCommand('forecolor', false, fCol);
> }
>
> function doBackCol()
> {
> var bCol = prompt('Enter background color', '');
>
> if(bCol != null)
> iView.document.execCommand('backcolor', false, bCol);
> }
>
> function doLink()
> {
> iView.document.execCommand('createlink');
> }
>
> function doImage()
> {
> var imgSrc = prompt('Enter image location', '');
>
> if(imgSrc != null)
> iView.document.execCommand('insertimage', false, imgSrc);
> }
>
> function doRule()
> {
> iView.document.execCommand('inserthorizontalrule', false, null);
> }
>
> function doFont(fName)
> {
> if(fName != '')
> iView.document.execCommand('fontname', false, fName);
> }
>
> function doSize(fSize)
> {
> if(fSize != '')
> iView.document.execCommand('fontsize', false, fSize);
> }
>
> function doHead(hType)
> {
> if(hType != '')
> {
> iView.document.execCommand('formatblock', false, hType);
> doFont(selFont.options[selFont.selectedIndex].value);
> }
> }
>
> function doToggleView()
> {
> if(viewMode == 1)
> {
> iHTML = iView.document.body.innerHTML;
> iView.document.body.innerText = iHTML;
>
> // Hide all controls
> tblCtrls.style.display = 'none';
> selFont.style.display = 'none';
> selSize.style.display = 'none';
> selHeading.style.display = 'none';
> iView.focus();
>
> viewMode = 2; // Code
> }
> else
> {
> iText = iView.document.body.innerText;
> iView.document.body.innerHTML = iText;
>
> // Show all controls
> tblCtrls.style.display = 'inline';
> selFont.style.display = 'inline';
> selSize.style.display = 'inline';
> selHeading.style.display = 'inline';
> iView.focus();
>
> viewMode = 1; // WYSIWYG
> }
> }
>
> function Send(form) {
> var iframeID = document.getElementById("iView");
> var middlebody = null;
> if (iframeID==null) {
> alert=("iFrame is NULL");
> } else {
> middlebody = iView.document.body.innerHTML;
> }
> var body = document.getElementById("upperMail").innerHTML +

middlebody
> + document.getElementById("lowerMail").innerHTML;
>
> for ( i=0; i < document.siteManagerForm.elements.length; ++i) {
> if ( document.siteManagerForm.elements[i].type == "hidden" ) {
> if ( document.siteManagerForm.elements[i].name ==

"mailContent"
> ) {
> document.siteManagerForm.elements[i].value = body;
> break;
> }
> }
> }
> form.submit();
> }
>
> function Preview(form) {
> var title = "<head><title>Letter Preview</title></head>";
> var closeButton = "<input type=button value=close
> onclick='window.close()'>";
> var line = "<hr border=\"1\" height=\"1px\" color=\"dee1f3\"/>"
>
> var middlebody = null;
>
> var iframeID = document.getElementById("iView");
> if (iframeID==null) {
> alert=("Warning: iFrame is NULL");
> } else {
> middlebody = iView.document.body.innerHTML;
> }
> var body = document.getElementById("upperMail").innerHTML +

middlebody
> + document.getElementById("lowerMail").innerHTML;
> var header = title+closeButton+line;
> var footer = line+closeButton;
> x=window.open("", "preview", "width=750, height=800, left=0, top=0,
> menubar=no, status=no, location=no, toolbar=no, scrollbars=yes,
> resizable=yes");
> x.document.write(header + body + footer);
> return false;
> }
>
> function Print() {
> document.getElementById("iView").contentWindow.pri nt();
> }


 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Run Javascript function upon Page Load from Page Load event handle Matcon ASP .Net 3 05-28-2008 05:15 PM
Load HTML page into another HTML page using Javascript Duke Javascript 1 04-18-2008 12:16 PM
How to explicitly run page javascript every time the page load? Jensen bredal ASP .Net 2 10-06-2005 09:10 AM
Page Load and webcontrol page load venky ASP .Net 5 07-11-2005 03:16 PM



Advertisments