home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC/CD Gamer UK 45
/
PCGAMER45.bin
/
netware
/
msie4pp
/
ie4_s3.cab
/
IE4_3.CAB
/
MSHTMENU.DLL
/
2110
/
FORPAR.DLG
< prev
next >
Wrap
Text File
|
1997-04-04
|
23KB
|
646 lines
<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML 3.2//EN">
<HTML STYLE="font: messagebox">
<HEAD>
<META NAME=GENERATOR CONTENT="Trident 3320">
<TITLE id=dialogTitle>
Paragraph
</TITLE>
<SCRIPT LANGUAGE=JavaScript>
//+-------------------------------------------------------------------------
//
// This section contains code to be moved into a GLOBAL MODULE outside
// of this particular dialog.
//
//--------------------------------------------------------------------------
//----------------------------------------------------------------------------------
//
// Synopsis: Takes a decimal value and returns its hexadecomal equivalent.
//
// Arguments: decimal The value to convert
//
// Returns: A hexadecimal string. NOTE: the string does not include the
// "0x" that's standard at the beginning of the hexadecimal numbers.
//
//----------------------------------------------------------------------------------
function CHex(decimal)
{
var hd = "0123456789ABCDEF";
lngConvert = parseInt(decimal);
if (decimal < 16)
{
return (hd.charAt(decimal));
}
else
{
return (CHex(decimal / 16) + hd.charAt(parseInt(decimal % 16)));
}
} // CHex
//--------------------------------------------------------------------------------
//
// Synopsis: Takes a six character string and swaps the first two and
// last two values. This is useful because queryCommandState returns
// color values with the red and blue values flipped.
//
// Arguments: strColor The 6 character string to be flipped.
//
// Returns: A 6 character string.
//
//-------------------------------------------------------------------------------
function colorFlip(strColor)
{
var strLeft;
var strRight;
strLeft = strColor.substring(0,2);
strRight = strColor.substring(4,6);
return strRight + strColor.substring(2,4) + strLeft;
} // colorFlip
//-----------------------------------------------------------------------------
//
// Synopsis: Takes a hexidecimal value and returns its decimal equivalent.
//
// Arguments: strHex The hexadecimal value
//
// Returns: A number
//
//-----------------------------------------------------------------------------
function CDec(strHex)
{
if ("0x" != strHex.substring(0,2))
{
strHex = "0x" + strHex;
}
return parseInt(strHex);
} // CDec
//----------------------------------------------------------------------
//
// Synopsis: Turns on the document's expando property. When this
// property is on, it is possible to create new expando
// properties or assign to existing ones.
//
// Arguments: none
//
// Returns: Nothing
//
//----------------------------------------------------------------------
function expandoOn()
{
document.expando = true;
} // expandoOn
//----------------------------------------------------------------------
//
// Synopsis: Turns off the document's expando property. When this
// property is off, it is possible to read the value of
// existing expando properties, but not possible to create
// new ones or modify existing ones.
//
// EXPANDO SHOULD BE OFF EXCEPT WHEN CREATING/MODIFYING
// EXPANDO PROPERTIES. This will save hours debugging
// accidentally created expando properties.
//
// Arguments: none
//
// Returns: Nothing.
//
//----------------------------------------------------------------------
function expandoOff()
{
document.expando = false;
} // expandoOff
//+--------------------------------------------------------------------------------
//
// Synopsis: Sets the state of a radio button based on a range and a command id.
// The command ID comes from the VALUE of the radio button. (It's
// prefixed by "_cmd".)
//
// Arguments: radio The radio button we're partying on
// range The range we're querying the status of
//
// Returns: nothing
//
//---------------------------------------------------------------------------------
function getRadioStateCmd(radio, range)
{
if (range.queryCommandEnabled(radio.value.substring(4)))
{
if(!range.queryCommandIndeterm(radio.value.substring(4)))
{
radio.checked = range.queryCommandState(radio.value.substring(4));
}
//
// Add code for indeterminate state
//
}
} // getRadioStateCmd
//+--------------------------------------------------------------------------------
//
// Synopsis: Sets the state of a select box based on a range and a command id.
// The command ID comes from the ID of the select box. (It's
// prefixed by "cmd".) NOTE: The VALUEs of OPTIONs of the SELECT box
// must be set to the possible return values of the queryCommandValue
// method.
//
// Arguments: radio The select box we're partying on
// range The range we're querying the status of
//
// Returns: nothing
//
//---------------------------------------------------------------------------------
function getSelectStateCmd(select, range)
{
if (globalDoc.queryCommandSupported(select.id.substring(3)))
{
for (index = 0; index < select.options.length; index++)
{
if ((select.options[index].value)
== (range.queryCommandValue(select.id.substring(3))))
{
select.selectedIndex = index;
break;
}
}
}
} // getSelectStateCmd
//---------------------------------------------------------------------------------
//
// Synopsis: Takes an element and a range and sets the state of the element
// based on the state of the range.
// HOW IT WORKS: See comments in the code.
//
// Arguments: element The element we're setting
// range The range we're querying the status of.
//
// Returns: nothing
//
//---------------------------------------------------------------------------------
function getStateCmd(element, range)
{
//
// Radio buttons that are set using a command id have a "_cmd" prefix in
// their VALUE. This is to distinguish them from radio buttons that are
// not set using a command id, but have to have the same name as radio
// buttons that are.
//
if (("radio" == element.type) && ("_cmd" == element.value.substring(0,4)))
{
getRadioStateCmd(element, range);
}
//
// SELECT boxes with the name "setCmdID" are set based on the command
// id in their ID property (minus the "cmd" prefix). See the notes in
// the getSelectStateCmd function for more info.
//
else if (("SELECT" == element.tagName) && ("setCmdID" == element.name))
{
getSelectStateCmd(element, range);
}
} // getStateCmd
//+--------------------------------------------------------------------------------
//
// Synopsis: Loops through all the elements in the dialog and sets the
// appropriate elements based on the type and properties of the
// element.
//
// Arguments: none
//
// Returns: nothing
//
//---------------------------------------------------------------------------------
function initDialogCmd()
{
var index;
for (index = 0; index < document.all("radJustify").length; index++)
{
getRadioStateCmd(document.all("radJustify")[index], globalDoc.selection.createRange());
}
getSelectStateCmd(cmd2234, globalDoc.selection.createRange());
} // initDialogCmd
//+--------------------------------------------------------------------------------
//
// Synopsis: Sets the state of a range based on the state of a radio button
// and a command id. The command id comes from the VALUE of the
// radio button. (It's prefixed by "_cmd".)
//
// Arguments: radio The radio button we're querying the state of
// range The range we're partying on
//
// Returns: nothing
//
//---------------------------------------------------------------------------------
function setRadioStateCmd(radio, range)
{
if (radio.checked != range.queryCommandState(radio.value.substring(4)))
{
if (range.queryCommandEnabled(radio.value.substring(4)))
{
range.execCommand(radio.value.substring(4));
}
}
} // setRadioStateCmd
//+--------------------------------------------------------------------------------
//
// Synopsis: Sets the state of a range based on the selection in a SELECT box
// and a command id. The command id comes from the ID of the SELECT
// box (minus the "cmd" prefix). NOTE: The VALUEs of the OPTIONs of the
// SELECT box must be set to the possible values for the execCommand
// method.
//
// Arguments: select The select box we're querying the value of.
// range The range we're partying on.
//
// Returns: nothing
//
//---------------------------------------------------------------------------------
function setSelectStateCmd(select, range)
{
if (globalDoc.queryCommandSupported(select.id.substring(3)))
{
range.execCommand(select.id.substring(3), false,
select.options[select.selectedIndex].value);
}
} // setSelectStateCmd
//---------------------------------------------------------------------------------
//
// Synopsis: Takes an element and a range and sets the state of the range
// based on the state of the element.
// HOW IT WORKS: See comments in the code.
//
// Arguments: element The element we're querying the status of.
// range The range we're partying on.
//
// Returns: nothing
//
//---------------------------------------------------------------------------------
function setStateCmd(element, range)
{
//
// Radio buttons that set apply a command id to a range have a "_cmd" prefix
// in their VALUE attribute. This is to distinguish them from radio buttons
// that aren't associated with a command id, but have the same name as radio
// buttons that are.
//
if (("radio" == element.type) && ("_cmd" == element.value.substring(0,4)))
{
setRadioStateCmd(element, range);
}
//
// SELECT boxes with a name of "setCmdID" effect the range based on the
// command id in their ID property (minus the "cmd" prefix). See the notes in
// the setSelectStateCmd function for more info.
//
else if (("SELECT" == element.tagName) && ("setCmdID" == element.name))
{
setSelectStateCmd(element, range);
}
} // setStateCmd
//+--------------------------------------------------------------------------------
//
// Synopsis: Loops through all the elements in the dialog and sets the
// properties of the document based on the type and properties of
// the element.
//
// Arguments: none
//
// Returns: nothing
//
//---------------------------------------------------------------------------------
function closeDialogCmd()
{
var index;
for (index = 0; index < document.all("radJustify").length; index++)
{
setRadioStateCmd(document.all("radJustify")[index], globalDoc.selection.createRange());
}
setSelectStateCmd(cmd2234, globalDoc.selection.createRange());
} // closeDialogCmd
//+---------------------------------------------------------------------
//
// Synopsis: Given a string, returns the number the string represents.
// This is needed because current localization tools can
// only find strings.
//
// Arguments: string The string we're changing into a number.
//
// Returns: a number
//
//----------------------------------------------------------------------
function number(string)
{
return parseFloat(string);
} // number
//+---------------------------------------------------------------------
//
// Synopsis: If the current selection is not text or none, walk up
// the tree until we select something that is
//
// Argument: doc The document we're partying on
//
// Returns: nothing
//
//----------------------------------------------------------------------
function walkToText(doc)
{
var currentRange;
var element;
while (("None" != doc.selection.type) && ("Text" != doc.selection.type))
{
currentRange = doc.selection.createRange();
element = currentRange.commonParentElement();
currentRange = doc.rangeFromElement(element);
currentRange.select();
}
} // walkToText
</SCRIPT>
<SCRIPT LANGUAGE=JavaScript>
//+--------------------------------------------------------------------------
//
// This section contains variables that need to be LOCALIZED
//
//---------------------------------------------------------------------------
var L_FormatParagraph_DIALOG_Width_Text = "30.4em";
var L_FormatParagraph_DIALOG_Height_Text = "15em";
var L_NoHelp_Text = "No help topic available.";
</SCRIPT>
<SCRIPT LANGUAGE=JavaScript>
//+-------------------------------------------------------------------------
//
// This section contains code LOCAL to this particular dialog.
//
//--------------------------------------------------------------------------
alert("Hit Alert");
expandoOff();
// Set dialog dimensions
window.width = L_FormatParagraph_DIALOG_Width_Text;
window.height = L_FormatParagraph_DIALOG_Height_Text;
// Global variables
var globalDoc = window.dialogArgs.document; // The document we're working on.
//+--------------------------------------------------------------------------------
//
// Synopsis: Looks at the currently selected text and fills the dialog options
// appropriately
//
// Arguments: None
//
// Returns: Nothing
//
//---------------------------------------------------------------------------------
function loadBdy()
{
walkToText(globalDoc);
initDialogCmd();
} //loadBdy
//-----------------------------------------------------------------------
//
// Synopsis: Closes the dialog without doing anything.
//
// Arguments: none.
//
// Returns: nothing
//
//-----------------------------------------------------------------------
function btnCancelClick()
{
window.close();
} // btnCancelClick
//+---------------------------------------------------------------------------------
//
// Synopsis: Goes through all the controls on the dialog and sets them to their
// default values. BUGBUG This function should go away once we can get
// a form inside a 2D div.
//
// Arguments: none.
//
// returns: nothing.
//
//----------------------------------------------------------------------------------
function btnClearClick()
{
cmd2234.value = "<P>"; // Paragraph style select box
// set to "Normal"
radJustifyLeft.checked = true; // Text alignment
} // btnClearClick
//+----------------------------------------------------------------------
//
// Synopsis: Closes the dialog after applying the user's selections
// to the document
//
// Arguments: none
//
// Returns: nothing
//
//-----------------------------------------------------------------------
function btnOKClick()
{
closeDialogCmd();
window.close();
} // btnOKClick
</SCRIPT>
<SCRIPT LANGUAGE=JavaScript FOR=document EVENT="onkeypress()">
//+---------------------------------------------------------------------
//
// Synopsis: Looks for the ENTER and ESCAPE keypresses and runs
// the default action.
//
// Arguments: see OM spec
//
// Returns: nothing
//
//-----------------------------------------------------------------------
var htmlKeyReturn = 13;
var htmlKeyEscape = 27;
if (event.keyCode == htmlKeyReturn)
{
btnOKClick();
}
else if (event.keyCode == htmlKeyEscape)
{
btnCancelClick();
}
</SCRIPT>
<SCRIPT LANGUAGE=JavaScript FOR=document EVENT="onhelp()">
//+-------------------------------------------------------------------------
//
// Synopsis: Opens the help file with the appropriate helpid
//
// Arguments: none
//
// Returns: nothing
//
//--------------------------------------------------------------------------
// BUGBUG Once we get help for the editing dialogs, this function
// will have to change.
alert(L_NoHelp_Text);
</SCRIPT>
</HEAD>
<BODY style="font: messagebox; background: 'buttonface';" onLoad="loadBdy()">
<DIV style="font: messagebox; position: absolute; LEFT: '1em'; TOP: '1em'; WIDTH: '8em'; HEIGHT: '1em'">
<LABEL For=cmd2234 id=lblParaStyle tabIndex=-1>
<U>P</U>aragraph Style
</LABEL>
</DIV>
<SELECT id=cmd2234 ACCESSKEY=p NAME="setCmdID" tabIndex=10
style="font: messagebox; LEFT: '1em'; TOP: '2.5em'; WIDTH: '27.7em'; HEIGHT: '2.1em'; position: absolute;">
<OPTION id=optNormal VALUE="<P>" selected> Normal </OPTION>
<OPTION id=optFormatted VALUE="<PRE>"> Formatted </OPTION>
<OPTION id=optAddress VALUE="<ADDRESS>"> Address </OPTION>
<OPTION id=optH1 VALUE="<H1>"> Heading 1 </OPTION>
<OPTION id=optH2 VALUE="<H2>"> Heading 2 </OPTION>
<OPTION id=optH3 VALUE="<H3>"> Heading 3 </OPTION>
<OPTION id=optH4 VALUE="<H4>"> Heading 4 </OPTION>
<OPTION id=optH5 VALUE="<H5>"> Heading 5 </OPTION>
<OPTION id=optH6 VALUE="<H6>"> Heading 6 </OPTION>
<OPTION id=optNumList VALUE="<OL>"> Numbered List </OPTION>
<OPTION id=optBullet VALUE="<UL>"> Bulleted List </OPTION>
<OPTION id=optDirList VALUE="<DIR>"> Directory List </OPTION>
<OPTION id=optMenuList VALUE="<MENU>"> Menu List </OPTION>
<OPTION id=optDefTerm VALUE="<DT>"> Definition Term </OPTION>
<OPTION id=optDef VALUE="<DD>"> Definition </OPTION>
</SELECT>
<TABLE cellspacing cellPadding=7 borderColorDark=buttonhighlight borderColorLight=buttonshadow border=1 noshade="yes"
style="position:absolute;font: messagebox;LEFT: '1em'; TOP: '5.5em'; WIDTH: '28em'; HEIGHT: '3em'">
<TR>
<TD style="font: messagebox; position: relative;LEFT: 0; TOP: 0; WIDTH: '19em'; HEIGHT: '2em'">
<DIV style="color: buttonface">a</DIV>
</TD>
</TR>
</TABLE>
<INPUT name=radJustify id=radJustifyLeft type=radio CHECKED ACCESSKEY=l VALUE=_cmdJustifyLeft tabIndex=15
style="font: messagebox; LEFT: '6.6em'; TOP: '6.5em'; position: absolute; WIDTH: '1em'; HEIGHT: '1em';">
<DIV style="font: messagebox; position: absolute;LEFT: '8.3em'; TOP: '6.5em'; WIDTH: '3em'; HEIGHT: '1em'">
<LABEL style="font: messagebox" For=radJustifyLeft id=lblJustifyLeft tabIndex="-1">
<U>L</U>eft
</LABEL>
</DIV>
<INPUT name=radJustify id=radJustifyCenter type=radio ACCESSKEY=c VALUE=_cmdJustifyCenter tabIndex=20
style="font: messagebox; LEFT: '12.1em'; TOP: '6.5em'; position: absolute; WIDTH: '1em'; HEIGHT: '1em'">
<DIV style="font: messagebox; position: absolute;LEFT: '13.8em'; TOP: '6.5em'; WIDTH: '4em'; HEIGHT: '1em'">
<LABEL style="font: messagebox" For=radJustifyCenter id=lblJustifyCenter tabIndex="-1">
<U>C</U>enter
</LABEL>
</DIV>
<INPUT name=radJustify id=radJustifyRight type=radio ACCESSKEY=r VALUE=_cmdJustifyRight tabIndex=25
style="font: messagebox; LEFT: '18.6em'; TOP: '6.5em'; position: absolute; WIDTH: '1em'; HEIGHT: '1em'">
<DIV style="font: messagebox; position: absolute;LEFT: '20.3em'; TOP: '6.5em'; WIDTH: '3em'; HEIGHT: '1.3em'">
<LABEL style="font: messagebox" For=radJustifyRight lblJustifyRight tabIndex="-1">
<U>R</U>ight
</LABEL>
</DIV>
<DIV style="font: messagebox; position: absolute;background: buttonface; HEIGHT: '1em'; LEFT: '1.5em'; TOP: '5em'; WIDTH: '5em'">
<LABEL id=lblAlign tabIndex="-1"> Align Text</LABEL>
</DIV>
<BUTTON id=btnOk onclick="btnOKClick()" tabIndex=30
style="font: messagebox; LEFT: '6.8em'; TOP: '9.5em'; WIDTH: '6.8em'; HEIGHT: '2.1em'; position: absolute">
OK</BUTTON>
<BUTTON id=btnClear onclick="btnClearClick()" tabIndex=35
style="font: messagebox; LEFT: '14.4em'; TOP: '9.5em'; WIDTH: '6.8em'; HEIGHT: '2.1em'; position: absolute">
Clear All</BUTTON>
<BUTTON id=btnCancel onclick="btnCancelClick()" tabIndex=40
style="font: messagebox; LEFT: '22em'; TOP: '9.5em'; position: absolute; WIDTH: '6.8em'; HEIGHT: '2.1em'">
Cancel</BUTTON>
</BODY></HTML>