[Javascript] How to change window status

Muchacho, Laurent (TWIi London) LMuchacho at twii.net
Thu Aug 28 05:18:16 CDT 2003


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  <mailto:dlovering at gazos.com> Lovering 
To: [JavaScript List] <mailto:javascript at LaTech.edu>  
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 <mailto:murugesan at hotpop.com>  
To: [JavaScript List] <mailto:javascript at LaTech.edu>  
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20030828/301ce32a/attachment.htm>


More information about the Javascript mailing list