Auto scroll to an anchor inside a cfdiv

Hi,

I have a CFDIV

<cfdiv name="test">
<a name="top">TOP</a>
<div style="height:5000px;">container</div>
<a name="bottom">BOTTOM</a>
</cfdiv>

I need to scroll to the anchor #bottom when i click on a link.

Please Help

Mike
quarkmikeAsked:
Who is Participating?
 
leakim971Connect With a Mentor PluritechnicianCommented:
Using the callback function :
http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=JavaScriptFcns_24.html

Work for me :
<a href="#bottom" onclick="ColdFusion.navigate('div.cfm?testValue=1','testDiv',function() { location.hash = '#';setTimeout(function() { location.hash = '#bottom'; },100); });return false;">Go to bottom</a>

Open in new window


This get the first link in the page : document.getElementsByTagName("a")[0]

<script>
document.getElementsByTagName("a")[0].onclick = function() {
	ColdFusion.navigate('div.cfm?testValue=1','testDiv',function() { 
		location.hash = "#";
		setTimeout(function() {
			location.hash = "#bottom";
		},100);
	});
	return false;
}
</script>

Open in new window

0
 
leakim971PluritechnicianCommented:
Use : <a name="bottom" id="bottom">BOTTOM</a>

and add : #bottom to your link
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/Cold_Fusion_Markup_Language/Q_28367507.html#bottom
0
 
quarkmikeAuthor Commented:
Thanks Leakim but i need to post value inside cfdiv and go to the anchor (bas) without refreshing the entire page .

Example

test.cfm
<cfdiv id="mike" style="width:100px; height:200px; overflow:hidden;" ></cfdiv>

<a onClick="ColdFusion.navigate('div.cfm?testValue=1','mike');">a</a>

 -------------------

div.cfm
<cfparam name="testValue" default="0">
<div style="height:500px;background-color:red;"><cfoutput>#now()#</cfoutput></div>
<a name="bas" id="bas">#testValue#</a>
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
leakim971PluritechnicianCommented:
Did you tried this?
<a onClick="ColdFusion.navigate('div.cfm?testValue=1#bas','mike');">a</a>
0
 
quarkmikeAuthor Commented:
Yes.
0
 
Rodrigo MuneraSr. Software EngineerCommented:
Mike:
<a href="#bottom" onClick="ColdFusion.navigate('div.cfm?testValue=1','mike');">Go to bottom</a>

Open in new window

0
 
quarkmikeAuthor Commented:
Don't work :/
0
 
leakim971PluritechnicianCommented:
Please provide a link to see that in live! Thanks :)
0
 
quarkmikeAuthor Commented:
http://www.cfmike.com/test/test.cfm


test.cfm
<cfdiv id="testDiv" style="width:100px; height:200px; overflow:scroll;" ></cfdiv>

<a href="#bottom" onClick="ColdFusion.navigate('div.cfm?testValue=1','testDiv');">Go to bottom</a>

div.cfm
<cfparam name="testValue" default="0">
<div style="height:500px;background-color:red;"><cfoutput>#now()#</cfoutput></div>
<cfoutput><a name="bottom" id="bottom">#testValue#</a></cfoutput>
0
 
quarkmikeAuthor Commented:
Thanks guys
0
All Courses

From novice to tech pro — start learning today.