We help IT Professionals succeed at work.
Get Started

Calling Javascript Function

273 Views
Last Modified: 2012-05-09
Hi I have a javascript enabled floating toolbar which I found on the web. It works perfectly for me, however there is one problem - each time I go to the page where it is used, I have to enable the toobar by clicking on the ACTIVATE  link - which make it somewhat awkward to use.

<a href="javascript:detach()" class="style6">ACTIVATE</a> (see javascript function below)

This enables the toolbar and I can then click on the other links to scroll to middle and bottom and back again to the top of a long listing. (see image of toolbar attached.)

I want to enable the toolbar automatically either by adding the 'detach' function to  one of the other links - BOTTOM, MIDDLE, TOP ..... or by having it fire with a mouseover command - the bar is contained in a div tag, which is in in turn in dv table tags. I have also tried incorporating it into the body tag. However I have not succeeded - it still requires me to click on the ACTIVATE link.

The codes I have tried are shown below.

Must be doing something stupid.. Appreciate someone to run an eye over it and flag the problem

Many thanks








function detach(){
      lay=document.getElementById('floatlayer');
      l=getXCoord(lay);
      t=getYCoord(lay);
      lay.style.position='absolute';
      lay.style.top=t;
      lay.style.left=l;
      getFloatLayer('floatlayer').initialize();
      alignFloatLayers();
Incorporating into body tag

BODY MARGINWIDTH=0 MARGINHEIGHT=0 
 onload="init();detach()"
 onresize="alignFloatLayers()"
 onscroll="alignFloatLayers()">

================================================

OnMouseOver approach

<td colspan="9" <div id="floatlayer" style="width:35%;background:#ffffff;padding:5px;border:solid blue 1px" onmouseover="MM_callJS('detach()')" > 

======================================================

Include the function within one of the other links .. like
<a href="javascript:jumpScrollmiddle()">MIDDLE</a> ... but dont know how to do this

Open in new window

toolbar.jpg
Comment
Watch Question
Software Engineer
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 16 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE