PDA

View Full Version : How do I link to text within scrollable content?



chrisjteas
01-11-2005, 02:59 AM
Script: DD Scrollable content
http://www.dynamicdrive.com/dynamicindex11/scrollc.htm

My page has a small scrollable box, and it has some <A HREF...> links on the page outside the box.

How do I get an <A HREF...> outside the scroll box to link and go to text inside the scroll box?

In other words, I want to click on the <A HREF...> link and have the scroll box automatically scroll and display its associated anchored text.

I'm sure this is simple, and your help is appreciated.

ddadmin
01-12-2005, 02:39 AM
Well, theoretically, you would just use a regular anchor (aka bookmark) link. So within your scrollable content where you want to jump to, add:

<a name="jumphere">Some text</a>

Then outside the box, create a link like:

<a href="#jumphere">Test</a>

which when clicked on should jump to "Some text." Now I say theoretically, because how a bookmark link behaves inside a scrollable Content for each browser may differ, and some not the way you want at all.

chrisjteas
01-13-2005, 12:55 AM
ddadmin,

Thanks for the response, but I guess it's a problem with all >IE 5.x browsers.

All I'm doing to test the page is using FrontPage's "Preview in Browser" function to select between Firefox, Netscape 7, or Explorer 5.5.

It works ok in all but Explorer. In Explorer, clicking the link opens a new page and then goes to that section.

Ever come across this?

The code is obvious, simple, and I have it without typos (SEE BELOW).

---Within scroll box---
<p CLASS="Section_Header1">
<a name="PM_SECTORS"><i><b>PM SECTORS</b></i></a></p>
.
.
---Outside scroll box---
<a href="#PM_SECTORS"><b>PM SECTORS</b></a>
.
.

FPit
01-13-2005, 05:42 AM
chrisjteas: your code works fine with me. You may want to try:

target="_self"

in the link outside the scroll box. Should make a difference though.
BTW, does it display the same behavior when you open the page from IE, rather than FrontPage with IE selected as default?

ddadmin
01-13-2005, 10:49 AM
ddadmin,

Thanks for the response, but I guess it's a problem with all >IE 5.x browsers.

All I'm doing to test the page is using FrontPage's "Preview in Browser" function to select between Firefox, Netscape 7, or Explorer 5.5.

It works ok in all but Explorer. In Explorer, clicking the link opens a new page and then goes to that section.

Ever come across this?

The code is obvious, simple, and I have it without typos (SEE BELOW).

---Within scroll box---
<p CLASS="Section_Header1">
<a name="PM_SECTORS"><i><b>PM SECTORS</b></i></a></p>
.
.
---Outside scroll box---
<a href="#PM_SECTORS"><b>PM SECTORS</b></a>
.
.

Hmmm I don't see how the link could possibly open in a new window. This is basic HTML we're using here, or bookmark links. BTW, I did test the code in IE6 WinXP, and it does jump to the intended place within the scrollable content.

FPit
01-13-2005, 11:57 AM
It works fine in IE, Mozilla, Firefox, and Opera (and forget that "_self" thing, it still works without it):



<ilayer name="scroll1" width=170 height=150 clip="0,0,170,150">
<layer name="scroll2" width=170 height=150 bgColor="lightyellow">
<div id="scroll3" style="width:170px;height:150px;background-color:lightyellow;overflow:scroll">
<big>T</big>his is a cool script that allows you to compact any content and confine it within a scrollable mini "window" Save valuable document space while making your page more "interactive", all at the same time! This script uses two different techniques- one for IE, one for NS- to <a name="PM_SECTORS"><i><b>PM SECTORS</b></i></a> create the scrollable window. Scrollbars will be available to IE 4 users to scroll the window, while NS users will need to use the "up" and "down" buttons instead (since NS does not support the adding of scrollbars to contents).
</div>
</layer>
</ilayer>

<script>

/***********************************************
* Scrollable content Script- Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

var nsstyle='display:""'
if (document.layers)
var scrolldoc=document.scroll1.document.scroll2
function up(){
if (!document.layers) return
if (scrolldoc.top<0)
scrolldoc.top+=10
temp2=setTimeout("up()",50)
}
function down(){
if (!document.layers) return
if (scrolldoc.top-150>=scrolldoc.document.height*-1)
scrolldoc.top-=10
temp=setTimeout("down()",50)
}

function clearup(){
if (window.temp2)
clearInterval(temp2)
}

function cleardown(){
if (window.temp)
clearInterval(temp)
}

</script>
<br><span style="display:none" style=&{nsstyle};><a href="#" onMousedown="up()"
onMouseup="clearup()" onClick="return false" onMouseout="clearup()">Up</a> | <a href="#"
onMousedown="down()" onMouseup="cleardown()" onClick="return false"
onMouseout="cleardown()">Down</a> | <a href="#" onClick="if (document.layers) scrolldoc.top=0;return false">Top</a> | <a href="#" onClick="if (document.layers) scrolldoc.top=scrolldoc.document.height*(-1)+150;return false">Bottom</a></span>

<a href="#PM_SECTORS"><b>PM SECTORS</b></a>

chrisjteas
01-13-2005, 01:33 PM
I found the problem!
It has something to do with FrontPage 2000's "Preview in browser" and testing with a local drive.

When I actually post the web page to the website and go to it in IE via www.... it works fine.

So, I don't have a solution, but the problem is now not big enough for me to worry about. Thanks for the replies, though.

ddadmin
01-14-2005, 12:12 AM
I found the problem!
It has something to do with FrontPage 2000's "Preview in browser" and testing with a local drive.

When I actually post the web page to the website and go to it in IE via www.... it works fine.

So, I don't have a solution, but the problem is now not big enough for me to worry about. Thanks for the replies, though.

It's probably not a problem at all then, and here's why:

1) Frontpage 2000's embedded browser for previewing most likely uses an outdated, stripped down version of IE, and definitely isn't IE6. Frontpage 2003's is.

2) The preview in browser feature doesn't simulate 100% an actual IE browser. This is the case with Frontpage 2003 as well.

Glad it's resolved for you either way. :)