473,804 Members | 2,124 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to load a page from file in browser using javascript

> Use x = window.Open(... ) x.document.writ e( 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.i nnerHTML

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

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

function selOn(ctrl)
{
ctrl.style.bord erColor = '#000000';
ctrl.style.back groundColor = '#B5BED6';
ctrl.style.curs or = 'hand';
}

function selOff(ctrl)
{
ctrl.style.bord erColor = '#D6D3CE';
ctrl.style.back groundColor = '#D6D3CE';
}

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

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

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

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

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

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

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

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

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

function doBulList()
{
iView.document. execCommand('in sertunorderedli st', false, null);
}

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

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

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

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

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

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

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

function doRule()
{
iView.document. execCommand('in serthorizontalr ule', false, null);
}

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

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

function doHead(hType)
{
if(hType != '')
{
iView.document. execCommand('fo rmatblock', false, hType);
doFont(selFont. options[selFont.selecte dIndex].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.d isplay = 'none';
selSize.style.d isplay = 'none';
selHeading.styl e.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.d isplay = 'inline';
selSize.style.d isplay = 'inline';
selHeading.styl e.display = 'inline';
iView.focus();

viewMode = 1; // WYSIWYG
}
}

function Send(form) {
var iframeID = document.getEle mentById("iView ");
var middlebody = null;
if (iframeID==null ) {
alert=("iFrame is NULL");
} else {
middlebody = iView.document. body.innerHTML;
}
var body = document.getEle mentById("upper Mail").innerHTM L + middlebody
+ document.getEle mentById("lower Mail").innerHTM L;

for ( i=0; i < document.siteMa nagerForm.eleme nts.length; ++i) {
if ( document.siteMa nagerForm.eleme nts[i].type == "hidden" ) {
if ( document.siteMa nagerForm.eleme nts[i].name == "mailConten t"
) {
document.siteMa nagerForm.eleme nts[i].value = body;
break;
}
}
}
form.submit();
}

function Preview(form) {
var title = "<head><title>L etter 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.getEle mentById("iView ");
if (iframeID==null ) {
alert=("Warning : iFrame is NULL");
} else {
middlebody = iView.document. body.innerHTML;
}
var body = document.getEle mentById("upper Mail").innerHTM L + middlebody
+ document.getEle mentById("lower Mail").innerHTM L;
var header = title+closeButt on+line;
var footer = line+closeButto n;
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.writ e(header + body + footer);
return false;
}

function Print() {
document.getEle mentById("iView ").contentWindo w.print();
}

Jul 23 '05 #1
1 7500

sa************* *@hotmail.com wrote:
Use x = window.Open(... ) x.document.writ e( 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.i nnerHTML

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

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

function selOn(ctrl)
{
ctrl.style.bord erColor = '#000000';
ctrl.style.back groundColor = '#B5BED6';
ctrl.style.curs or = 'hand';
}

function selOff(ctrl)
{
ctrl.style.bord erColor = '#D6D3CE';
ctrl.style.back groundColor = '#D6D3CE';
}

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

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

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

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

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

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

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

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

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

function doBulList()
{
iView.document. execCommand('in sertunorderedli st', false, null);
}

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

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

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

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

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

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

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

function doRule()
{
iView.document. execCommand('in serthorizontalr ule', false, null);
}

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

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

function doHead(hType)
{
if(hType != '')
{
iView.document. execCommand('fo rmatblock', false, hType);
doFont(selFont. options[selFont.selecte dIndex].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.d isplay = 'none';
selSize.style.d isplay = 'none';
selHeading.styl e.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.d isplay = 'inline';
selSize.style.d isplay = 'inline';
selHeading.styl e.display = 'inline';
iView.focus();

viewMode = 1; // WYSIWYG
}
}

function Send(form) {
var iframeID = document.getEle mentById("iView ");
var middlebody = null;
if (iframeID==null ) {
alert=("iFrame is NULL");
} else {
middlebody = iView.document. body.innerHTML;
}
var body = document.getEle mentById("upper Mail").innerHTM L +

middlebody + document.getEle mentById("lower Mail").innerHTM L;

for ( i=0; i < document.siteMa nagerForm.eleme nts.length; ++i) {
if ( document.siteMa nagerForm.eleme nts[i].type == "hidden" ) {
if ( document.siteMa nagerForm.eleme nts[i].name == "mailConten t" ) {
document.siteMa nagerForm.eleme nts[i].value = body;
break;
}
}
}
form.submit();
}

function Preview(form) {
var title = "<head><title>L etter 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.getEle mentById("iView ");
if (iframeID==null ) {
alert=("Warning : iFrame is NULL");
} else {
middlebody = iView.document. body.innerHTML;
}
var body = document.getEle mentById("upper Mail").innerHTM L + middlebody + document.getEle mentById("lower Mail").innerHTM L;
var header = title+closeButt on+line;
var footer = line+closeButto n;
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.writ e(header + body + footer);
return false;
}

function Print() {
document.getEle mentById("iView ").contentWindo w.print();
}


Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3407
by: Dariusz | last post by:
I have a problem with a call a Javascript "window.open()" function which is executed as part of a PHP file when a user clicks on an thumbnail image. The PHP is executed which passes some variables to Javascript to execute the new window opening. But as it does this, the main window is loaded which is blank (the browser URL bar shows the URL of the URL passed to the PHP / Javascript script). I would like to keep the gallery page visible...
3
8438
by: Ed Brandmark | last post by:
I have a tag of the form <SCRIPT LANGUAGE="JavaScript1.1" SRC="foo.js"..... and was wondering if this delays the loading of my page until that file foo.js downloads. It seems that if I place this in the HEAD of my document - the page will wait until it downloads. If I place it in the BODY of my document - supposedly the page
8
4837
by: Mr. x | last post by:
Hello, I wrote a javascript, and when I open the html by the browser, I get the message : Error in page. It is about tousand lines, and I cannot figure out in a simple way, where is the line, that cause the error ? I see on other computers, a message like " ... do you wish to debug".
25
19979
by: chris | last post by:
how would i resize a browser window to a specific size as the page loads, using html or javascript
4
2669
by: Jake Lewis | last post by:
I have an HTML page that loads fine including the .js file <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Untitled Document</title> <script language="JavaScript" type="text/JavaScript" src="ve3d.js" ></script> </head>
3
2127
by: Shapper | last post by:
Hello, I am working on an ASP.NET/VB web site. I have several links including menu links. Considerer a want to load a page named page.aspx. I can do it using javascript. Or using this code: Sub loadPage(sender As Object, e As System.EventArgs, pageURL as String)
1
1712
by: jmohan | last post by:
Hi everyone, I am developing a website using asp.net with C#. And I developed a toolbar using javascript like google and yahoo toolbar which is placed in the browser separately. Toolbar has the toolbar id. I need to capture the toolbar id and save into the mysql database during the page load.
12
5630
by: Geoff Cox | last post by:
Hello I'm having a problem loading a frameset file using an include in a php file. Nothing is displayed and when I look at the source code I see that <html> <head> <title></title>
3
3014
by: Sunny | last post by:
Hi, Can someone tell me, How to load the Body Html from a text file that contains javascript. to Manage my files I am creating an Index Page. <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title></title>
5
4754
by: memiller | last post by:
I know this generally not recommended, but I'm working in the confines of the company's intranet. Goal: permit managers to load an XML file from thier PC into an intranet ASP.NET webpage where validation and data submit will take place. I have the page written that allows the user to select a file. I'm hitting a wall when, after selecting the file, trying to open a new page and inserting the XML into the page. From there I can start...
0
9595
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10600
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10352
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10354
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10097
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7642
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6867
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5535
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3835
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.