PassMark Logo
Home » Forum


No announcement yet.

Jump to search result...

  • Filter
  • Time
  • Show
Clear All
new posts

  • Jump to search result...

    I am creating a Javascript version of this search that will be on a CD. When I click on a search result I want it to direct me to the spot on the page where the result is found(instead of what it does now, which is just brings me to the top of the page)... how can I make it do this? Any help would be much appreciated.


  • #2
    Assuming your pages are HTML pages, see the jump and hightlight script.


    • #3
      Thanks, I guess I should have read the FAQ huh? I actually did get it figured out! But now I have ANOTHER problem.

      The pages that are being searched already have a javascript in them that makes a "return to top" button float up and down the page as it is being scrolled. When I go to the pages through the "search results page" the highlight.js must be canceling that script... any ideas on how to work around that? Thanks in advance for your help!
      Last edited by rudybob77; 01-11-2008, 10:07 PM.


      • #4
        Javascripts interfering with each other are fairly common. There is a troubleshooting page here.

        Do you really need a floating "return to top" button. The "Home" and "End" keys on the keyboard do this job just fine in Firefox and IE.


        • #5
          Unfortunately I do need a "return to top" button. The client I am doing this for is really anal and HAS to have it. Plus, this is a CD that will be packaged with a book and I am sure a lot of the users wont know they can hit the home key.


          • #6
            I went through the troubleshooting and still cannot get this to work. Here is my code... thanks again for the help.

            <!-- TemplateBeginEditable name="doctitle" -->
            <TITLE>This is a test</TITLE>
            <!-- TemplateEndEditable -->
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

            <!-- Search highlight code //-->
            <script type="text/JavaScript" src="../highlight.js"></script>
            <style type="text/css">.highlight { background: #FFFF40; }</style>


            <body onload="highlight();">


            <!-- Begin Floater Code //-->

            // Insert the entire script just before the </div></body> tag.
            // Set the following two position parameters
            // Negative numbers are relative to right (hX) or bottom (vY)
            // Positive numbers are relative to left (hX) or (vY) top
            // Experiment with values to get positioning exact, and allow
            // for the dimensions of the image & form in the positioning

            var hX = 750;
            var vY = -80;


            <!-- Edit the HTML between the div tags to suit your design //-->
            <div id="FloatMail" style="position: absolute;
            width: 13px;">
            <a href="#"></a>
            <a href="#"><img src="../images/top.png" width="29" height="18" border="0"></a>

            <!-- End of editable HTML //-->

            /* Caution! Do not allow linebreaks other than where shown */
            var good;function checkEmailAddress(field){
            var goodEmail=field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.go v)|(\.org)|(\..{2,2}))$)\b/gi);
            if (goodEmail){good = true}else{alert('Please enter a valid e-mail address.');
            u=window.location;m="I thought this might interest you...";
            function mailThisUrl(){good=false;
            if (good){window.location="mailto:"+document.eMailer. address.value+"?subject="+m+"&body="+document.titl e+" "+u;}}
            var nn=(navigator.appName.indexOf("Netscape")!=-1);
            var dD=document,dH=dD.html,dB=dD.body,px=dD.layers?'': 'px';
            function floatMail(iX,iY,id){
            var L=dD.getElementById?dD.getElementById(id):dD.all?d D.all[id]:dD.layers[id];
            this[id+'O']=L;if(dD.layers);L.nX=L.iX=iX;L.nY=L.iY=i Y;
            L.P=function(x,y){; top=y+px;};L.Fm=function(){var pX, pY;
            pX=(this.iX >=0)?0:nn?innerWidth:nn&&dH.clientWidth?dH.clientW idth:dB.clientWidth;
            pY=nn?pageYOffset:nn&&dH.scrollTop?dH.scrollTop:dB .scrollTop;
            if(this.iY<0)pY+=nn?innerHeight:nn&&dH.clientHeigh t?dH.clientHeight:dB.clientHeight;
            return L;}

            <!-- End FloatMail Code //-->



            • #7
              Did you try the alternative method of calling the highlight() function as described on the support page?

              An alternative to the above method of calling "highlight()" in the onload attribute, would be to call the highlight function after the </body> tag on the page, as follows:
              ... rest of page here. This is the bottom of the webpage.
              <script type="text/javascript">highlight();</script>
              Wrensoft Web Software
              Sydney, Australia
              Zoom Search Engine


              • #8
                Yea, I have tried that and it doesn't work either. I'm in a pickle.


                • #9
                  Send us an e-mail and we can provide you with a beta copy of the new highlight script we are working on. It may be more compatible with your "Return to Top" Javascript.
                  Wrensoft Web Software
                  Sydney, Australia
                  Zoom Search Engine


                  • #10
                    Originally posted by Ray View Post
                    Send us an e-mail and we can provide you with a beta copy of the new highlight script we are working on. It may be more compatible with your "Return to Top" Javascript.
                    Thanks, I just sent you an email.

                    Many Thanks!