Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: help on error with .hta


Message #1 by True2ViSioN@a... on Sun, 21 Oct 2001 18:24:38 EDT
How much are you willing to pay?? (j/k)

Maybe post the error, and more info... I (and im sure others) don't
really have hours on hand to read over this much code.

daniel

--------------------------
Daniel O'Dorisio
daniel@o...
www.odorisio-networks.com
--------------------------

-----Original Message-----
From: True2ViSioN@a... [mailto:True2ViSioN@a...] 
Sent: Sunday, October 21, 2001 6:25 PM
To: javascript
Subject: [javascript] help on error with .hta



i made my program into a .hta (all most like .exe) and i have a some
probs 
and i want to know if some one could help me fix them i tryed to send it
as a 
file but it would not let me so all send code in mail and you can make
it 
into a hta and if you know how to make it into a .exe let me know and if
you 
have any improvment ideas let me know....... i thank you all for your
help if 
you do this

--TRUE--

-=code im sending the hole thing becaues i dont know what the problem
is=-

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<title>(system-power)-=-(notepad)</title>
<HTA:APPLICATION ID="oHTA"
     APPLICATIONNAME="system-power notepad"
     BORDER="thin"
     BORDERSTYLE="normal"
     CAPTION="yes"
     ICON="graphics/S-P_file=icon.ico"
     MAXIMIZEBUTTON="yes"
     MINIMIZEBUTTON="yes"
     SHOWINTASKBAR="no"
     SINGLEINSTANCE="no"
     SYSMENU="yes"
     VERSION="2.0"
     WINDOWSTATE="1200x1200"
     SCROLLBAR="no"
  >

<SCRIPT>

  /* This function also gets the value of commandLine,
     which cannot be set as an attribute  */
   
  function fnShowProp()
  {
    sTempStr = "applicationName  = " + oHTA.applicationName + "\y" + 
               "border           = " + oHTA.border          + "\n" +
               "borderStyle      = " + oHTA.borderStyle     + "\n" + 
               "caption          = " + oHTA.caption         + "\n" +
               "commandLine      = " + oHTA.commandLine     + "\n" +
               "icon             = " + oHTA.icon            + "\y" +
               "maximizeButton   = " + oHTA.maximizeButton  + "\y" +
               "minimizeButton   = " + oHTA.minimizeButton  + "\y" + 
               "showInTaskBar    = " + oHTA.showInTaskBar   + "\n" +
               "singleInstance   = " + oHTA.singleInstance  + "\n" +  
               "sysMenu          = " + oHTA.sysMenu         + "\n" + 
               "version          = " + oHTA.version         + "\y" + 
               "scrollbar        = " + oHTA.scrollbar       + "\n" +
           "windowState      = " + oHTA.windowState     + "\y" ;
          
    oPre.innerText = sTempStr;        
  }
  </SCRIPT>

<link href="/common/default.css" rel="stylesheet" type="text/css">
<style type="text/css">

body {
  margin: 0px;
}

#menuBar {
  background-color: lightgrey;
  border-style: solid;
  border-width: 0px;
  border-top-color: #888888;
  border-top-width: 2px;
  border-bottom-color: #888888;
  border-bottom-width: 2px;
  color: black;
  padding: 0px;
  padding-top: 2px;
  padding-bottom: 2px;
  position: absolute;
  left: 0px;
  top: 0px;
  text-align: left;
  width: 100%;
  z-index: 100;
}

a.menuButton, a.menuButtonActive {
  border-style: solid;
  border-width: 1px;
  border-color: silver;
  color: black;
  cursor: default;
  font-family: "MS Sans Serif", Arial, Tahoma, sans-serif;
  font-size: 8pt;
  font-style: normal;
  font-weight: normal;
  padding: 2px;
  padding-left: 6px;
  padding-right: 6px;
  position: relative;
  left: 0px;
  top: 0px;
  text-decoration: none;
}

a.menuButton:hover {
  border-color: white black black white;
  color: black;
  background-color: 0080DD;
  font-weight: normal;
}

a.menuButtonActive, a.menuButtonActive:hover {
  background-color: #003070;
  border-color: black black black black;
  color: aqua;
  left: 1px;
  top: 1px;
  font-weight: normal;
}

.menu {
  background-color: lightgrey;
  border-style: solid;
  border-width: 2px;
  border-top-color: #f0f0f0;
  border-right-color: #909090;
  border-bottom-color: #909090;
  border-left-color: #f0f0f0;
  padding: 0px;
  position: absolute;
  text-align: left;
  visibility: hidden;
  z-index: 101;
}

a.menuItem {
  color: black;
  cursor: default;
  display: block;
  font-family: "MS Sans Serif", Arial, Tahoma,sans-serif;
  font-size: 8pt;
  font-style: normal;
  font-weight: normal;
  margin: 0px;
  padding: 2px;
  padding-left: 20px;
  padding-right: 20px;
  text-decoration: none;
  white-space: nowrap;
}

a.menuItem:hover {
  background-color: #0000BB;
  color: white;
  font-weight: normal;
}

.menuItemSep {
  border-bottom: 1px solid #f0f0f0;
  border-top: 1px solid #909090;
  margin: 3px 2px 3px 2px;
}
BUTTON {cursor:hand;
        background:lightgrey; 
    font-weight:bold;
        border-top-color:lightgrey;
        border-right-color:lightgrey;
        border-bottom-color:lightgrey;
        border-left-color:lightgrey;
    color:4668DF;
    over:#2244BB;
    link text-decoration:none; color:black
}

.bar{background:lightgrey;
        width:100%;
        height:10px;
        border-top:1px solid #446688;
        border-bottom:1px solid black;}

</style>
<script type="text/javascript">

// Determine browser and version. Script works for IE 5.5+ and NS 6.0+

function Browser() {

  var ua, s, i;

  this.isIE    = false;  // Internet Explorer
  this.isNS    = false;  // Netscape
  this.version = null;

  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }
}

var browser = new Browser();

// For IE, adjust menu bar styling.

if (browser.isIE) {
  document.styleSheets[document.styleSheets.length -
1].addRule("#menuBar", 
"padding-top:4px");
  document.styleSheets[document.styleSheets.length -
1].addRule("#menuBar", 
"padding-bottom:3px");
}

// Global variable for tracking the currently active button.

var activeButton = null;

// Capture mouse clicks on the page so any active button can be //
deactivated.

if (browser.isIE)
  document.onmousedown = pageMousedown;
if (browser.isNS)
  document.addEventListener("mousedown", pageMousedown, true);

function pageMousedown(event) {

  var className;

  // If the object clicked on was not a menu button or item, close any
  // active menu.

  if (browser.isIE)
    className = window.event.srcElement.className;
  if (browser.isNS)
    className = (event.target.className ?
      event.target.className : event.target.parentNode.className);

  if (className != "menuButton"  && className != "menuItem" &&
      className != "menuItemSep" && activeButton)
    resetButton(activeButton);
}

function buttonClick(button, menuName) {

  // Blur focus from the link to remove that annoying outline.

  button.blur();

  // Associate the named menu to this button if not already done.

  if (!button.menu)
    button.menu = document.getElementById(menuName);

  // Reset the currently active button, if any.

  if (activeButton && activeButton != button)
    resetButton(activeButton);

  // Toggle the button's state.

  if (button.isDepressed)
    resetButton(button);
  else
    depressButton(button);

  return false;
}

function buttonMouseover(button, menuName) {

  // If any other button menu is active, deactivate it and activate this
one.
  // Note: if this button has no menu, leave the active menu alone.

  if (activeButton && activeButton != button) {
    resetButton(activeButton);
    if (menuName)
      buttonClick(button, menuName);
  }
}

function depressButton(button) {

  // Change the button's style class to make it look like it's
depressed.

  button.className = "menuButtonActive";

  // For IE, set an explicit width for the first menu item. This causes
  // mouseovers to work for all the items even when cursor is not over
  // the link text.

  if (browser.isIE && !button.menu.firstChild.style.width)
    if (browser.version < 6.0)
      button.menu.firstChild.style.width = button.menu.offsetWidth +
"px";
    else
      button.menu.firstChild.style.width = "1em";

  // Position the associated drop down menu under the button and
  // show it. Note that the position must be adjusted according to
  // browser, styling and positioning.

  x = getPageOffsetLeft(button);
  y = getPageOffsetTop(button) + button.offsetHeight;
  if (browser.isIE || (browser.isNS && browser.version >= 6.1))
    y += 2;
  if (browser.isNS && browser.version < 6.1) {
    x--;
    y--;
  }
  button.menu.style.left = x + "px";
  button.menu.style.top  = y + "px";
  button.menu.style.visibility = "visible";

  // Set button state and let the world know which button is
  // active.

  button.isDepressed = true;
  activeButton = button;
}

function resetButton(button) {

  // Restore the button's style class.

  button.className = "menuButton";

  // Hide the button's menu.

  if (button.menu)
    button.menu.style.visibility = "hidden";

  // Set button state and clear active menu global.

  button.isDepressed = false;
  activeButton = null;
}

function getPageOffsetLeft(el) {

  // Return the true x coordinate of an element relative to the page.

  return el.offsetLeft + (el.offsetParent ? 
getPageOffsetLeft(el.offsetParent) : 0);
}

function getPageOffsetTop(el) {

  // Return the true y coordinate of an element relative to the page.

  return el.offsetTop + (el.offsetParent ?
getPageOffsetTop(el.offsetParent) 
: 0);
}

</script>

<SCRIPT>
function SaveGraph()
{

document.execCommand('SaveAs')
return false;
}

</SCRIPT>

</head>
<body BGCOLOR="black" TEXT="#668BFF">




<!-- Tags for the menu bar. -->

<div id="menuBar"
><a class="menuButton"
    href=""
    onclick="return buttonClick(this, 'fileMenu');"
    onmouseover="buttonMouseover(this, 'fileMenu');"
>File</a
><a class="menuButton"
    href=""
    onclick="return buttonClick(this, 'editMenu');"
    onmouseover="buttonMouseover(this, 'editMenu');"
>Edit</a
><a class="menuButton"
    href=""
    onclick="return buttonClick(this, 'viewMenu');"
    onmouseover="buttonMouseover(this, 'viewMenu');"
>View</a
><a class="menuButton"
    href=""
    onclick="return buttonClick(this, 'toolsMenu');"
    onmouseover="buttonMouseover(this, 'toolsMenu');"
>Tools</a
><a class="menuButton"
    href=""
    onclick="return buttonClick(this, 'optionsMenu');"
    onmouseover="buttonMouseover(this, 'optionsMenu');"
>Format</a
><a class="menuButton"
    href=""
    onclick="return buttonClick(this, 'helpMenu');"
    onmouseover="buttonMouseover(this, 'helpMenu');"
>Help</a
></div>


<!-- Tags for the drop down menus. -->

<div id="fileMenu" class="menu">
<a class="menuItem" href="-----------">new  </a>
<a class="menuItem" href="-----------">open  </a>
<a class="menuItem" href="-----------">save </a>
<a class="menuItem" href="#" onClick="return SaveGraph()"> save as</a>
<div class="menuItemSep"></div> <a class="menuItem" href="#"
onClick="window.print();" >print </a> <a class="menuItem"
href="-----------">print preview </a> <a class="menuItem"
href="-----------">print setup </a> <a class="menuItem"
href="-----------">page setup </a> <div class="menuItemSep"></div> <a
class="menuItem" href="#"  onClick="window.close();"> exit </a> </div>

<div id="editMenu" class="menu">
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('undo','','');strTextRichT
ext.fo

cus();">undo </a>
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('redo','','');strTextRichT
ext.fo

cus();">redo </a>
<div class="menuItemSep"></div>
<a class="menuItem" href="#">select all </a>
<a class="menuItem" href="#">clear all </a>
<div class="menuItemSep"></div>
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('cut','','');strTextRichTe
xt.foc

us();">cut </a>
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('copy','','');strTextRichT
ext.fo

cus();">copy </a>
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('paste','','');strTextRich
Text.f

ocus();">paste </a>
</div>

<div id="viewMenu" class="menu">
<a class="menuItem" href="-----------">zoom in </a> 
<a class="menuItem" href="-----------">zoom out </a>
<a class="menuItem" href="-----------">normal 100% </a>
<a class="menuItem" href="-----------">full screan </a>
<div class="menuItemSep"></div>
<a class="menuItem" href="-----------">find </a>
<a class="menuItem" href="-----------">goto </a>
</div>

<div id="toolsMenu" class="menu">
<a class="menuItem" href="-----------">customize </a>
<a class="menuItem" href="-----------">note pad options </a> <div
class="menuItemSep"></div> <a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('insertimage','',prompt('I
mage 
URL'));strTextRichText.document.execCommand('fontsize','','2');strTextRi
chText

.focus();"> add a piture </a>
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('createLink','',prompt('Pl
ease 
enter your URL to link to'));strTextRichText.focus();"> add a link </a>

<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('Italic','','');strTextRic
hText.

focus();"> <i>italic</i> </a> 
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('bold','','');strTextRichT
ext.fo

cus();"> <b>bold</b> </a>
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('insertunorderedlist','','
');str

TextRichText.focus();"> insert tunorderedlist </a> 
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('insertorderedlist','','')
;strTe

xtRichText.focus();"> insert torderedlist </a>
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('justifyleft','','');strTe
xtRich

Text.focus();"> justify left </a> 
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('justifycenter','','');str
TextRi

chText.focus();"> justify center </a>
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('justifyright','','');strT
extRic

hText.focus();"> justify right </a> 
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('indent','','');strTextRic
hText.

focus();"> indent  </a> 
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('outdent','','');strTextRi
chText

.focus();"> outdent </a>
<div class="menuItemSep"></div>
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('fontsize','','1');strText
RichTe

xt.focus();">font-8</a>
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('fontsize','','2');strText
RichTe

xt.focus();">font-10</a>
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('fontsize','','3');strText
RichTe

xt.focus();">font-12</a>
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('fontsize','','4');strText
RichTe

xt.focus();">font-14</a>
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('fontsize','','5');strText
RichTe

xt.focus();">font-18</a>
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('fontsize','','6');strText
RichTe

xt.focus();">font-24</a>
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('fontsize','','7');strText
RichTe

xt.focus();">font-36</button></a>
<div class="menuItemSep"></div>
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('underline','','');strText
RichTe

xt.focus();">underline</a>
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('StrikeThrough','','');str
TextRi

chText.focus();">StrikeThrough</a>
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('SuperScript','','');strTe
xtRich

Text.focus();">SuperScript</a>
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('SubScript','','');strText
RichTe

xt.focus();">SubScript</a>
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('cut','','');strTextRichTe
xt.foc

us();">cut</a>
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('copy','','');strTextRichT
ext.fo

cus();">copy</a>
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('paste','','');strTextRich
Text.f

ocus();">paste</a>
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('undo','','');strTextRichT
ext.fo

cus();">undo</a>
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('redo','','');strTextRichT
ext.fo

cus();">redo</a>
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('fontcolor','','');strText
RichTe

xt.focus();">fontcolor</a>
<a class="menuItem" href="#"  
onClick="strTextRichText.document.execCommand('highlight','','');strText
RichTe

xt.focus();">highlight</a>
</div>

<div id="optionsMenu" class="menu">
<a class="menuItem" href="-----------">background color </a>
<a class="menuItem" href="-----------">font color </a>
<a class="menuItem" href="-----------">play work music </a> <div
class="menuItemSep"></div> <a class="menuItem" href="#"
onclick="document.location='S-P_notepad.html'"> 
restart </a>
</div>

<div id="helpMenu" class="menu">
<a class="menuItem" href="help.html">help topics </a>
<a class="menuItem" href="FAQs.html">FAQ's </a>
<a class="menuItem" href="http://system-power.cjb.net">web site for more
help 
</a>
<div class="menuItemSep"></div>
<a class="menuItem" href="about.html">about</a>
</div>


<br>




<!-- prefill the box -->
<input type="hidden" name="strText" value="(c) copy right 2002
system-power 
(r) all right reserved (p) protected by law">
<!-- TYPEING Field -->
<iframe id="strTextRichText" onBlur="output();" onFocus="fill();"
width=100% 
height=98%></iframe>


<!-- set the html field to be design mode -->
<script>
strTextRichText.document.designMode="on";
</script>


<script>

//fill the value
function fill()
{
if(strTextRichText.document.body.innerHTML=="")
{
strTextRichText.document.body.innerHTML=document.forms[0].strText.value;
}
}

//output the value
function output()
{
document.forms[0].strText.value=strTextRichText.document.body.innerHTML;
}

//set the focus
document.all['strTextRichText'].focus();



</script>


            </td></tr>



</BODY>
</HTML>

  Return to Index