Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #11 (permalink)  
Old October 6th, 2009, 01:01 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hyderabad, A.P., India.
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

The event you are using for scrolling those blocks is onmousemove, and the example i gave uses "onmouseover". Try changing the "onmouseover" event in "start()" and "stop()" functions to "onmousemove"!
Code:
function start() {
            document.getElementById('hmenu').onmousemove = autoscroll(e);
        }
        // function to stop the move over event
        function stop() {
            document.getElementById('hmenu').onmousemove = null;
        }
__________________
- Rakesh
http://iam-rakesh.blogspot.com
Reply With Quote
  #12 (permalink)  
Old October 6th, 2009, 01:06 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hyderabad, A.P., India.
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

One more thing you need not pass the event object while adding onmousemove event in "start()" method
Code:
document.getElementById('hmenu').onmousemove = autoscroll;
the above code will do. I just tried on the url you gave, its working :-)
__________________
- Rakesh
http://iam-rakesh.blogspot.com
Reply With Quote
  #13 (permalink)  
Old October 6th, 2009, 08:44 AM
Authorized User
 
Join Date: Aug 2009
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

yes perfection to last detail 5*

thank you:

this works...

<head>
<script type="text/javascript" src="http://www.semiotically.com/ascroll.js"></script>
<script type="text/javascript" >
function init (){
document .getElementById ('hmenu').onmousemove=autoscroll;
}
window.onload = init;
</script>

<script>
// function to start animation of sort on mouse over
function start() {
document.getElementById('hmenu').onmousemove = autoscroll;
}
// function to stop the move over event
function stop() {
document.getElementById('hmenu').onmousemove = null;
}
// initialize on page load
window.onload = init;
</script>
</head>

<body>
<h1 id="hmenu" style="color:red;"></h1>
<input type="button" value="StartScroll" onclick="start()" />
<input type="button" value="StopScroll" onclick="stop()" /> now working...
</body>

Last edited by semiotically; October 6th, 2009 at 08:53 AM.
Reply With Quote
  #14 (permalink)  
Old October 6th, 2009, 09:10 AM
Authorized User
 
Join Date: Aug 2009
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Rakesh, will this code streamline things, is a recommendation from another:

All you need to do is create a variable to hold whether to scroll or not:
Code:

var keepScrolling=true;

Then change the autoscroll function to look something like this:
Code:

function autoscroll(e)
{
//If the boolean is set to false, stop the function here rather than continuing
if(keepScrolling==false) return;

var mousx = 0;
var mousy = 0;
var doid=this.id;
var dobj=document.getElementById(doid);
if (!e) var e = window.event;
if (e.pageX || e.pageY)
{
mousx = e.pageX;
mousy = e.pageY;
}
else if (e.clientX || e.clientY)
{
mousx = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
mousy = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
}
var offx = offy = 0;
while(dobj) // calculate the actual x&y offsets of the element to be scrollled
{
offx+=dobj.offsetLeft;
offy+=dobj.offsetTop;
dobj=dobj.offsetParent;
}
relx=mousx-offx; // Relative mouse positions wrt the element
rely=mousy-offy;
dobj=document.getElementById(doid);
var margn=dobj.offsetWidth/10;
if(relx<margn) relx=margn;
if(relx > (dobj.offsetWidth-margn)) relx=dobj.offsetWidth-margn;
dobj.finy=parseInt(( dobj.scrollHeight - dobj.offsetHeight ) * (rely-margn) / (dobj.offsetHeight-2*margn));
dobj.finx=parseInt(( dobj.scrollWidth - dobj.offsetWidth ) * (relx-margn) / (dobj.offsetWidth-2*margn));
if(!dobj.speedy && !dobj.speedx) // If not already scrolling
{ dobj.speedy=0;
dobj.speedx=0;
scrollToFin(doid);
}
}

Then change your start and stop functions to the following:
Code:

function start() {
keepScrolling=true;
}
// function to stop the move over event
function stop() {
keepScrolling=false;
}
Reply With Quote
  #15 (permalink)  
Old October 6th, 2009, 11:08 PM
Authorized User
 
Join Date: Aug 2009
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi another implementation.

1. Am using this script:

<script language=javascript>function loadsource()
{
var defaultPage = "tweets.html";
var query = window.location.search.substring(1);
var pos = query.indexOf('=');
if (pos > 0)
{
var frameSource = query.substring(pos+1);
window.frames["righthere"].location = frameSource;
}
else
{
window.frames["righthere"].location = defaultPage;
}
}
</script>

with this code:

<body onLoad="loadsource()">

This scipt allows me to load external content into IFrames (within index.html), try if you wish: http://www.semiotically.com/index.html?fs=cv.pdf

THE ISSUE:

When using <body onLoad="loadsource()"> it intereferes with the scrolling script, and although still works you have to manually click start scrolling button. So how can I alter this little snippet to achieve same effect though with the scrolling still active straightaway?
Reply With Quote
  #16 (permalink)  
Old October 8th, 2009, 01:02 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hyderabad, A.P., India.
Posts: 373
Thanks: 0
Thanked 1 Time in 1 Post
Default

Have one method attached to 'onload' event and call both the fuctions loadsource(), and autoscroll() from it. OR you can try by adding both the methods to onload event, seperate them with ';'
Code:
<body onload="loadsource();autoscroll();">
__________________
- Rakesh
http://iam-rakesh.blogspot.com
Reply With Quote
  #17 (permalink)  
Old October 8th, 2009, 04:51 AM
Registered User
 
Join Date: Oct 2009
Location: China
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to amandaboard Send a message via Skype™ to amandaboard
Default Optical Mark Reader Scanner

NANHAO Optical Mark Reader (OMR Scanner) is a high speed data capture device which is mainly used for recognizing the filled datas in all kind of info-Forms. Itís highest reading speed can reach nearly 8000 info-Forms per hour (A4)
NANHAO Optical Mark Reader (OMR Scanner) has been largely used in all kind areas of high speed data processing, such as school examination, vote, transportation, human resources, fiscal taxation and finance and so on.
Reply With Quote
Reply


Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
dynamically add a new row to a existing GridView srkvellanki ASP.NET 2.0 Professional 1 September 21st, 2008 10:15 PM
Will static dataset affect the performance? hhkris4u ASP.NET 1.0 and 1.1 Professional 1 January 9th, 2007 12:05 PM
Accessing a Pre-existing Shape on a Worksheet excelthoughts C# 0 June 21st, 2006 03:00 AM
javascript - add element to existing xml? willgotoo XML 4 October 8th, 2004 10:33 AM



All times are GMT -4. The time now is 07:26 PM.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.