does anyone knows how to move the bottom of current page, after i press the "button"

  • Thread starter Thread starter Alan Ho
  • Start date Start date
Hello Peter,

try this:

<script language="javascript">
function doscroll(){
x=document.body.scrollHeight;
x=x+99999
window.scrollTo(0,x);
}
</script>

then in your button's tag add onclick="doscroll()"
 
cheers~
Martin Carolan said:
Hello Peter,

try this:

<script language="javascript">
function doscroll(){
x=document.body.scrollHeight;
x=x+99999
window.scrollTo(0,x);
}
</script>

then in your button's tag add onclick="doscroll()"
 
Hello Alan,

in your code just add

button1.Attributes.Add("onclick", "doscroll()");

That should work.
 
i tried it...
but it seems still not work........
Martin Carolan said:
Hello Alan,

in your code just add

button1.Attributes.Add("onclick", "doscroll()");

That should work.
 
Dear Martin,
I put the Button2.Attributes.Add("onClick", "doscroll()"); in
webForm2.aspx.cs as below

private void Button2_Click(object sender, System.EventArgs e)
{
Button2.Attributes.Add("onClick", "doscroll()");

}

and in html

<script language="javascript">
function doscroll(){
x=documen.body.scrollHeight;
x=x+999;
self.scrollTo(0,100);}</script>
<h2>
<asp:Button id="Button2" style="Z-INDEX: 101; LEFT: 352px; POSITION:
absolute; TOP: 912px" runat="server" Text="Button"
onClick="doscroll()"></asp:Button></h2>
after i try to run it...show the error message
"CS0117: 'ASP.WebForm2_aspx' not include 'doscroll' define / declare
 
Hello Alan,

In your html you need to change

<asp:Button id="Button2" style="Z-INDEX: 101; LEFT: 352px; POSITION:
absolute; TOP: 912px" runat="server" Text="Button"
onClick="doscroll()"></asp:Button>

to

<asp:Button id="Button2" style="Z-INDEX: 101; LEFT: 352px; POSITION:
absolute; TOP: 912px" runat="server" Text="Button"></asp:Button>

Martin.
 
Dear Martin,
Thank you your help
I have followed and changed it. And i can run it. however,
when i press the Button2 ....which it nothing happen.....it seem haven't run
the doscroll()....
help please..
Thanks..
^_^
Alan
 
Hello Alan,

Can you send me the html from the view source? (i.e. in your browser after
it's been processed on the server)

Martin.
 
sent it
thanks
Martin Carolan said:
Hello Alan,

Can you send me the html from the view source? (i.e. in your browser after
it's been processed on the server)

Martin.
 
Do you want this button to perform a postback? If not, then you might try
just using a standard HTML button <input type="button" ...> and attaching
the client-side onclick event to the tag.

The implementation for this will be different if the button posts back to
the server.
 
If you want to jump to a certain point in a page, you can set a named
anchor on your page, then reference it with an href tag. This is a
straight HTML method.

-------------------------
<a name="top">Top of Page</a><br/>
<a href="#bottom">Go To bottom of Page</a>
<br/><!--Add enough HTML to make the scroll evident-->
<br/>
<a href="#top">Go to Top</a><br/>
<a name="bottom">Bottom of Page</a>
 
Back
Top