Javascript bug? Naming onclick event handlers in EBMM?

Post your questions and problem reports here.

Javascript bug? Naming onclick event handlers in EBMM?

Postby Dr Paul A Daniels » Mon Mar 10, 2008 11:34 pm

I don't know if it helps but I spotted what may be a typo in function ebmDisplaySubmenu. At about character 1025 there's the following code:

Code: Select all
...if(isMz)m.style.magrinRight=20...


Should 'magrin' be 'margin'?
<hr>

I want my buttons/submenu items to load a static HTML page into an ID'd <div> area. How do I nominate my Javascript onclick event handler functions within EBMM? I use the %IncFile pre-processor function to update my buttons/menus within my page so that I can keep everything nice 'n modular. If I have to doctor the HTML/Javascript output from EBMM everytime then that's a real :evil: .
Dr Paul A Daniels
Director, Qsoft Limited
Dr Paul A Daniels
 
Posts: 11
Joined: Mon Mar 03, 2008 11:02 am
Location: Frimley Green, UK

Postby Karlis » Thu Mar 13, 2008 2:19 pm

Will take a look.
Karlis Blumentals
Blumentals Software
www.blumentals.net
User avatar
Karlis
Site Admin
 
Posts: 3624
Joined: Mon Jul 15, 2002 5:24 pm
Location: Riga, Latvia, Europe

Re: Javascript bug? Naming onclick event handlers in EBMM?

Postby Dr Paul A Daniels » Fri Mar 14, 2008 4:10 am

Dr Paul A Daniels wrote:I want my buttons/submenu items to load a static HTML page into an ID'd <div> area. How do I nominate my Javascript onclick event handler functions within EBMM? I use the %IncFile pre-processor function to update my buttons/menus within my page so that I can keep everything nice 'n modular. If I have to doctor the HTML/Javascript output from EBMM everytime then that's a real :evil: .


I figured out a way to solve the problem! Links typed into EBMM appear in the output HTML as href="LinkText" where LinkText might be something like /MyFolder/MyPage.htm#MySection. I needed to open the linked documents in an IFRAME with an ID of, say, MyClient. To do this I entered the following link into EBMM:

/MyFolder/MyPage.htm#MySection" target="MyClient

Note the two double-quotes: one after my original link and one after the target=.

When EBMM outputs this to the HTML it wraps the entire thing in double-quotes and so embeds the name of the target frame. This works for both buttons and submenu items, no additional JavaScript is required and no modification of the EBMM-generated HTML or JavaScript is required. This keeps the menu's built modular.

Perhaps, Karlis, as well as a link field in EBMM we could have a target field too so that this workaround isn't necessary?

I hope this helps some of you.
Dr Paul A Daniels
Director, Qsoft Limited
Dr Paul A Daniels
 
Posts: 11
Joined: Mon Mar 03, 2008 11:02 am
Location: Frimley Green, UK

Re: Javascript bug? Naming onclick event handlers in EBMM?

Postby Dr Paul A Daniels » Sun Mar 16, 2008 5:42 am

I figured out a way to solve the problem!...


Er, it appears I 'spoke' too soon :oops: .

I discovered that it works perfectly within WeBuilder 2007 (v8.31) but not properly using IE7 (either using a local IIS or by uploading to my web-site) and I can't get it to work at all with Firefox 2.

With WeBuilder both the buttons and submenu items correctly load the new page into the ID'd IFRAME area.

With IE7 the buttons are OK and correctly load the button's target as a new page into the ID'd IFRAME area but the submenu items insist on loading into the full browser window.

With FF2 neither the buttons nor the submenu items will load anything into the IFRAME area.

Any ideas what I might be doing wrong?
Dr Paul A Daniels
Director, Qsoft Limited
Dr Paul A Daniels
 
Posts: 11
Joined: Mon Mar 03, 2008 11:02 am
Location: Frimley Green, UK

Re: Javascript bug? Naming onclick event handlers in EBMM?

Postby Dr Paul A Daniels » Sun Mar 16, 2008 7:51 pm

OK, I think I've got it sorted now but, unfortunately, it does require a small modification to the EBMM-generated JavaScript file that will have to be made everytime the menu is re-generated by EBMM.

Find the following piece of code in function ebmGenerateTree:

Code: Select all
p.onclick=function(){window.location.href=this.rowClickLink}


and change it to:

Code: Select all
p.onclick=function(){window.frames['Client'].src=this.rowClickLink}


where, in my case, 'Client' is the ID of the IFRAME I wanted to use as my target. Selecting menu items now opens the new page within the IFRAME; this approach is, of course, restricted to just one IFRAME. Perhaps a future ability to optionally associate a target with each button/menuitem would be possible?

Incidentally, the problem with FF was because I'd set the z-index of the IFRAME to be -1 so that the menus would open above it. Removing that z-index and, instead, setting the z-index of my DIV containing the menu buttons to 10 (or some other large number) cured the problem.

Everything now works as I wanted but it would be nice if there were some better way to use the buttons to perform tasks other than just loading a new page into the full browser window. Given that so many web-pages now use Ajax techniques to do so many things it would be nice if there were more 'hooks' into the button/submenu click (and other?) events.
Dr Paul A Daniels
Director, Qsoft Limited
Dr Paul A Daniels
 
Posts: 11
Joined: Mon Mar 03, 2008 11:02 am
Location: Frimley Green, UK

Postby Aivars » Sat Mar 22, 2008 4:38 pm

The next version (which is almost finished by now) includes functionality that allows specifying link targets. That should solve the problem.
User avatar
Aivars
Blumentals Software Developer
 
Posts: 2374
Joined: Thu Aug 22, 2002 1:40 pm
Location: Latvia


Return to Easy Button & Menu Maker Support

Who is online

Users browsing this forum: No registered users and 1 guest