JavaScript.CoolDev.Com Support Forums

Any questions related to JavaScript menu and JavaScript tree menu by Javascript.CoolDev.Com

 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ocode example

 
Post new topic   Reply to topic    JavaScript.CoolDev.Com Forum Index -> COOLjsMenu
Author Message
ledford



Joined: 11 Jun 2003
Posts: 2
Location: US - Montana

PostPosted: Thu Jun 19, 2003 4:09 pm    Post subject: ocode example Reply with quote

Hello - I was hoping that someone could give me an example of how to use the ocode keyword. I am trying to do a mouseover effect on my site. For example:

onMouseOver="original.src='new.jpg'" onMouseOut="original.src='original.jpg'"

And I was wondering if the ocode keyword field would allow for this type of effect. Or if there is another way of accomplishing this in the keyword fields.

Thanks for the help!
Back to top
Fosco
Guest





PostPosted: Thu Jun 19, 2003 7:27 pm    Post subject: Reply with quote

multiple ways to do this...

code:"<img src=a.gif>", ocode:"<img src=b.gif>"

or

code:"", format:{image:"a.gif", oimage:"b.gif", imgsize:[35,100]}
Back to top
ledford



Joined: 11 Jun 2003
Posts: 2
Location: US - Montana

PostPosted: Mon Jun 23, 2003 10:23 pm    Post subject: Reply with quote

Hi, Thanks for the help but I'm afraid that I didn't explain my problem clearly enough. What I would like to do is a mouseover effect on my menu such that an image elsewhere on the page (not on the menu bar) is changed when the mouse passes over a field in the menu bar. For instance if a menu bar with following roots and children were created:

Green Red Blue Yellow
Light Light Light Light
Dark Dark Dark Dark

When the mouse passes over each of the items in the menu above an image elsewhere in the page (for instance ballons) in another location on the page, NOT in the menu, changes to the corresponding color that the mouse passes over in the menu. I'm not sure if this is possible, but if it is please let me know how. Sorry for the cheesy example. Thanks again for your help!
Back to top
Abakus
Guest





PostPosted: Tue Jun 24, 2003 3:20 pm    Post subject: Show Hide elements Reply with quote

Hi,
I have the same problem.

If you want to call some JavaScript function to show or hide some layer, you can do it like in the following snippet:

['Node caption', 'javascript:void(myOwnFunction())', null],

Try this and let me know if it works.
Back to top
AlexKunin
Developer


Joined: 03 Jan 2003
Posts: 1191

PostPosted: Tue Jun 24, 2003 4:13 pm    Post subject: Reply with quote

Try to use the following piece of code:
Code:
window.mEvent_old = mEvent;
mEvent = function (m, i, e) {
   var item = window.CMenus[m].items[i];
   if (e == 'o') {
      // handle rollover
   } else if (e == 't') {
      // handle rollout
   }
   window.mEvent_old(m, i, e);
}

You have to insert it before tree initialization code. Instead of "//" comments add your code to handle corresponding events. In your code you can use properties of the "item" variable to determine which item is/was under mouse cursor. Among these properties there is "fmt" which is copy of "format" field for this item from the menu_items.js, and you can define your own properties, e.g.:
Code:
{'code':'My Item', 'format':{"hint":"This is hint text."}, ...

And then in the handler code you can obtain hint for the item which was rolled over:
Code:
if (item.fmt.hint) someWeirdFunction(item.fmt.hint);
Back to top
Display posts from previous:   
Post new topic   Reply to topic    JavaScript.CoolDev.Com Forum Index -> COOLjsMenu All times are GMT
Page 1 of 1