[Javascript] How to change window status
David Lovering
dlovering at gazos.com
Thu Aug 28 11:27:07 CDT 2003
I agree with the other chap -- what we have here is a syntax problem with too many quotes of the wrong sort. Escape the inner double-quotes (so they don't break the parsing structure for the tag), and you should be OK.
Thusly:
menu.addMenuItem("<a class='M' href='/index1.php' style='text-decoration: none' target='info' onmouseover='window.status=\"blah-blah-blah\" '>Click here</a>");
and we should be good to go. You do need to use both sorts of quotes, because consecutive descending child objects must be delineated by distinctive separators. [Or so I recall].
If you want to insert a variable in place of "blah-blah-blah", you can try the following:
var myString = "blah-blah-blah";
var newItem = "<a class='M' href='/index.php' style='text-decoration: none' target='info' onmouseover='window.status=\" ' + myString + ' \" ' > Click here </a>";
menu.addMenuItem( newItem );
[ depending on the flavor of JavaScript (1.0, 2.0, etc.) you may need to wrap the newItem declaration in an eval, although I didn't need to on any of my tests. ]
Just on general principles, I'd probably suggest escape(myString) instead of raw myString -- just in case "myString" has any funky characters in it.
-- Dave Lovering
----- Original Message -----
From: murugesan
To: [JavaScript List]
Sent: Thursday, August 28, 2003 2:42 AM
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
------------------------------------------------------------------------------
_______________________________________________
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/115feda6/attachment.htm>
More information about the Javascript
mailing list