Home » Forum
  • If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Announcement

Collapse
No announcement yet.

Jump to search result...

Collapse
X
  • 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.

    Thanks!

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

    Comment


    • #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.

      Comment


      • #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.

        Comment


        • #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.

          Comment


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



            <HTML>
            <HEAD>
            <!-- 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>


            </HEAD>

            <body onload="highlight();">


            <center>
            Content
            </center>



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

            // 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;

            </script>

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


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

            <script>
            /* 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.');
            field.focus();field.select();good=false;}}
            u=window.location;m="I thought this might interest you...";
            function mailThisUrl(){good=false;
            checkEmailAddress(document.eMailer.address);
            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.style=L;L.nX=L.iX=iX;L.nY=L.iY=i Y;
            L.P=function(x,y){this.style.left=x+px;this.style. 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;
            this.nX+=.1*(pX+this.iX-this.nX);this.nY+=.1*(pY+this.iY-this.nY);this.P(this.nX,this.nY);
            setTimeout(this.id+'O.Fm()',33);};
            return L;}
            floatMail(hX,vY,'FloatMail').Fm();
            </script>

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




            </body></html>

            Comment


            • #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.
              </body>
              <script type="text/javascript">highlight();</script>
              </html>
              --Ray
              Wrensoft Web Software
              Sydney, Australia
              Zoom Search Engine

              Comment


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

                Comment


                • #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.
                  --Ray
                  Wrensoft Web Software
                  Sydney, Australia
                  Zoom Search Engine

                  Comment


                  • #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!

                    Comment

                    Working...
                    X