[Javascript] How to change window status

murugesan murugesan at hotpop.com
Thu Aug 28 08:15:29 CDT 2003


I do understand what you mean exactly.


function loadmenu(
    if (window.unregmenu1) 
        return;
window.menu1 = new Menu("root",121,16,"Arial, Verdana, Helvetica, sans-serif",14,"#000000","#000000","#5D7AB1","#9DB5D1","left","middle",3,0,1000,-5,7,true,true,true,0,true,true);  

  var status1=' asdasd';
  var link="<a class=M href='/vic4a/modules/visitor/contractsignup.php?visnme="
     +visnme
     +"&mailid="
   +mailid
   +"&tntid="
   +tntid
   +"&flag="
     +flag
     +"'"
     +"onmouseover='window.status=\"asdasd\" ' "
     +"onmouseout='window.status=\"\" ' "
     +"text-decoration:none target='info' ><font size =2 color=white><b >Contract Sign Up</b></font></a>"
  
menu1.addMenuItem(link);
....

Here only onmouseout works and onmouseover neither gives jscript errors nor gives output




function Menu(label, mw, mh, fnt, fs, fclr, fhclr, bg, bgh, halgn, valgn, pad, space, to, sx, sy, srel, opq, vert, idt, aw, ah) 
{
 this.version = "020320 [Menu; mm_menu.js]";
 this.type = "Menu";
 this.menuWidth = mw;
 this.menuItemHeight = mh;
 this.fontSize = fs;
 this.fontWeight = "plain";
 this.fontFamily = fnt;
 this.fontColor = fclr;
 this.fontColorHilite = fhclr;
 this.bgColor = "#555555";
 this.menuBorder = 1;
 this.menuBgOpaque=opq;
 this.menuItemBorder = 1;
 this.menuItemIndent = idt;
 this.menuItemBgColor = bg;
 this.menuItemVAlign = valgn;
 this.menuItemHAlign = halgn;
 this.menuItemPadding = pad;
 this.menuItemSpacing = space;
 this.menuLiteBgColor = "#ffffff";
 this.menuBorderBgColor = "#777777";
 this.menuHiliteBgColor = bgh;
 this.menuContainerBgColor = "#cccccc";
 this.childMenuIcon = "arrows.gif";
 this.submenuXOffset = sx;
 this.submenuYOffset = sy;
 this.submenuRelativeToItem = srel;
 this.vertical = vert;
 this.items = new Array();
 this.actions = new Array();
 this.childMenus = new Array();
 this.hideOnMouseOut = true;
 this.hideTimeout = to;
 this.addMenuItem = addMenuItem;
 this.writeMenus = writeMenus;
 this.MM_showMenu = MM_showMenu;
 this.onMenuItemOver = onMenuItemOver;
 this.onMenuItemAction = onMenuItemAction;
 this.hideMenu = hideMenu;
 this.hideChildMenu = hideChildMenu;
 if (!window.menus) window.menus = new Array();
 this.label = " " + label;
 window.menus[this.label] = this;
 window.menus[window.menus.length] = this;
 if (!window.activeMenus) window.activeMenus = new Array();
}




function addMenuItem(label, action) {
 this.items[this.items.length] = label;
 this.actions[this.actions.length] = action;
}






Thanks for the information.
-murugesan

  ----- Original Message ----- 
  From: Muchacho, Laurent (TWIi London) 
  To: '[JavaScript List]' 
  Sent: Thursday, August 28, 2003 3:48 PM
  Subject: RE: [Javascript] How to change window status


  Hi 

  The probleme here is not using single or double quote. 
  I guess the method you calling addMenuItem is part of an object this method will write the string you put as parameter.
  into a the page with document.write or dynamicly into a div with .innerHTML 

  if you do something like this 

  examples1
  var myString='<a href="linktopage.htm" onmouseover="window.status=\'click to go there\'">linked page</a>';
  document.write (myString);
  or
  example2
  var myString="<a href='linktopage.htm' onmouseover='window.status="click to go there"'>linked page</a>";
  document.write (myString);
   
  it work fine but if you look at your code you should not write html with single quote(example2) but double quote(example1), there you start to confuse yourself trying to decide which quote to use what I always do is, if your string contain HTML use single quote(example1)  like this no confusion with your html and if you need to put single quote inside of your html, you can simply escape them(example1) and like this you had a clear representation of you quote inside of your string.

  But this is not the end in your case this is not garanty to work at all because of the process you using. When you past string like this throw parameter of a function you must understand what addMenuItem is doing because when the code will try to write dynamicly this string into a div or in a page it might already evaluate the string inside the function and will not accept the format is reading.

  My recomendation will be to convert the addMenuItem method to include window.status inside of the method because your addMenuItem must have already an onmouseover inside (to make appear submenu) and you will end up with something like this 

  menu.addMenuItem('hrefLabel', '/index1.php', 'status text', 'className')

  Sometime you will find easier to convert the method the way you want it exactly to work instead of trying to hack it. I understand this might more difficult the just trying to the right quote but you will learn valuable knowledge and will understand why your string concatenation doesn't work.

  Good luck 
  Laurent 

  ps : if you really don't understand send the us the code or a link to a page and I will be happy to help



    -----Original Message-----
    From: murugesan [mailto:murugesan at hotpop.com]
    Sent: 28 August 2003 10:43
    To: [JavaScript List]
    Subject: Re: [Javascript] How to change window status


    I tried this,
        menu.addMenuItem("<a class='M' href='/index1.php' style='text-decoration: none' target='info' onmouseover='window.status="blah-blah-blah"'>Click here</a>");
    But it is not correct.
    because the javascript assumes ....' window.status=" as end of parameter and resulted in error
    I also tried
        var status1="asdasd";
        var menuitem1="<a href='/index1.php' "
                                +"onmouseover='window.status="
                                +status1
                                +" ' "
                                +" > Click here</a>"
        menu.addMenuItem(menuitem1);
    This time it is just displaying onmouseover in the status bar
    Any solutions
    -murugesan

      ----- Original Message ----- 
      From: David Lovering 
      To: [JavaScript List] 
      Sent: Thursday, August 28, 2003 11:38 AM
      Subject: Re: [Javascript] How to change window status


      well, I'm not quite sure what "text" is supposed to represent, but I do recognize what might be construed as a syntax anomaly which would (possibly) invalidate the remainer of the anchor definition.  Try something like this --

      menu.addMenuItem("<a class='M' href='/index1.php' style='text-decoration: none' target='info' onmouseover='window.status="blah-blah-blah"'>Click here</a>");

      Also, the old precidence rules suggest (but I've never actually found it to be required) that the outer quotes be the double quote ("), and the inner quotes be the single (').  Mind you, I've violated the suggestion hundreds of times, and no one has zapped my karma yet.  However, defining a style (CSS) parameter outside of a style declaration is generally regarded as a no-no even now.

      -- Dave Lovering
        ----- Original Message ----- 
        From: murugesan 
        To: [JavaScript List] 
        Sent: Wednesday, August 27, 2003 10:16 PM
        Subject: [Javascript] How to change window status


        I have a code

        menu.addMenuItem("<a class=M href='/index1.php' text-decoration:none target='info' >Click here</a>");

        Now I want to change the window status upon mouseover on this link.
        How can I achieve this?
        i.e I need a valid statement of form
        menu.addMenuItem("<a class=M href='/index1.php' text-decoration:none target='info'  onmouseover=' window.status="text" '>Click here</a>");

        -murugesan


------------------------------------------------------------------------


        _______________________________________________
        Javascript mailing list
        Javascript at LaTech.edu
        https://lists.LaTech.edu/mailman/listinfo/javascript



--------------------------------------------------------------------------


      _______________________________________________
      Javascript mailing list
      Javascript at LaTech.edu
      https://lists.LaTech.edu/mailman/listinfo/javascript




  DISCLAIMER - The preceding e-mail message (including any attachments) contains information that may be confidential, may be protected by the attorney-client or other applicable privileges, or may constitute non-public information. It is intended to be conveyed only to the designated recipient(s) named above. If you are not an intended recipient of this message, or have otherwise received it in error, please notify the sender by replying to this message and then delete all copies of it from your computer system. Any use, dissemination, distribution, or reproduction of this message by unintended recipients is not authorized and may be unlawful. The contents of this communication do not necessarily represent the views of this company.



------------------------------------------------------------------------------


  _______________________________________________
  Javascript mailing list
  Javascript at LaTech.edu
  https://lists.LaTech.edu/mailman/listinfo/javascript
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20030828/d3fe2995/attachment.htm>


More information about the Javascript mailing list