Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > click makes page scroll far right

Reply
Thread Tools

click makes page scroll far right

 
 
anna
Guest
Posts: n/a
 
      04-08-2004
Is it possible to have a javascript function which can scroll a page
to the far right when a link is clicked? Any code examples available?

TIA,
Anna
 
Reply With Quote
 
 
 
 
anna
Guest
Posts: n/a
 
      04-09-2004
I tried the examples and it works fine with input type=button but
doesn't work with type=image.

Any way to make it work? Using the image look less clunky.

<input type="button" value=">>" onClick="alignRight();"> //this works

<input type="image" src="/icons/redarrow.gif" onClick="alignRight();">
//rather have this work
 
Reply With Quote
 
 
 
 
anna
Guest
Posts: n/a
 
      04-09-2004
What I ended up doing and it works for browsers NN4, NN7, and IE6.

<a href="javascript:window.scrollTo(1000,0)"><img
src="/icons/redarrow.gif" border=0 alt="Scroll right"></a>
 
Reply With Quote
 
anna
Guest
Posts: n/a
 
      04-14-2004
SOLUTION:


What I ended up doing and it works for browsers NN4, NN7, and IE6.

<a href="javascript:window.scrollTo(1000,0)"><img
src="/icons/redarrow.gif" border=0 alt="Scroll right"></a>
 
Reply With Quote
 
anna
Guest
Posts: n/a
 
      04-26-2004
FOLLOWUP


if (navigator.appName.indexOf("Netscape") != -1 &&
parseFloat(navigator.appVersion) < 5 ) {
if (document.width > window.innerWidth) {
document.write('<a
href="javascript:window.scrollTo(1000,window.pageY Offset)"><img
src="/icons/redarrow.gif" border=0 alt="Scroll right"><img
src="/icons/redarrow.gif" border=0 alt="Scroll right"></a>');
}
} else {
if (document.body.scrollWidth > document.body.clientWidth) {
document.write('<a
href="javascript:window.scrollTo(1000,document.bod y.scrollTop)"><img
src="/icons/redarrow.gif" border=0 alt="Scroll right"><img
src="/icons/redarrow.gif" border=0 alt="Scroll right"></a>');
}
}
 
Reply With Quote
 
Thomas 'PointedEars' Lahn
Guest
Posts: n/a
 
      04-27-2004
anna wrote:

> FOLLOWUP


Do you really know what a followup is and what medium you are using?

<http://www.faqs.org/faqs/usenet/posting-rules/part1/>

> if (navigator.appName.indexOf("Netscape") != -1 &&
> parseFloat(navigator.appVersion) < 5 ) {


Nonsense. <http://pointedears.de.vu/scripts/test/whatami>

Better:

if (typeof document.width != "undefined"
&& typeof document.innerWidth != "undefined")
{

> if (document.width > window.innerWidth) {
> document.write('<a
> href="javascript:window.scrollTo(1000,window.pageY Offset)"><img

^^^^^^^^^^^^
Nonsense. <http://jibbering.com/faq/#FAQ4_24>

Better:

if (document.width > window.innerWidth) {
document.write(
'<a
+ ' href="javascript:void(window.scrollTo(1000,window. pageYOffset))"'
+ ' onclick="window.scrollTo(1000, window.pageYOffset); return false"'
+ '><img ...');

> src="/icons/redarrow.gif" border=0 alt="Scroll right"><img
> src="/icons/redarrow.gif" border=0 alt="Scroll right"></a>');


This will not work as supposed if you provide only one link with two images.

> }
> } else {
> if (document.body.scrollWidth > document.body.clientWidth) {


Again you did not test for those host objects and their properties before
accessing them. See above.

> document.write('<a
> href="javascript:window.scrollTo(1000,document.bod y.scrollTop)"><img


See above.

> src="/icons/redarrow.gif" border=0 alt="Scroll right"><img
> src="/icons/redarrow.gif" border=0 alt="Scroll right"></a>');


See above.

> }
> }



PointedEars
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Functionality to scroll into view? (autoamtically scroll to contentsin the bottom right corner of a large web page) crazychrisy54@hotmail.com Javascript 8 12-20-2007 08:28 AM
Functionality to scroll into view? (autoamtically scroll to contentsin the bottom right corner of a large web page) crazychrisy54@hotmail.com Javascript 0 12-19-2007 02:09 PM
Using a div with scroll bars - can we get the scroll bars on the left instead of the right side? UJ ASP .Net 1 11-01-2006 09:32 PM
Taking table-less CSS design far too far Andy Dingley HTML 45 06-11-2006 07:14 PM
Tool to enable Right click on pages where Right click is disabled tsteinke@gmail.com Computer Support 4 08-28-2005 11:53 PM



Advertisments