|
|
 |
| 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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |
|

October 6th, 2009, 01:01 AM
|
|
Friend of Wrox
|
|
Join Date: Mar 2007
Location: Hyderabad, A.P., India.
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
|
|
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;
}
|

October 6th, 2009, 01:06 AM
|
|
Friend of Wrox
|
|
Join Date: Mar 2007
Location: Hyderabad, A.P., India.
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
|
|
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 :-)
|

October 6th, 2009, 08:44 AM
|
|
Registered User
|
|
Join Date: Aug 2009
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|

October 6th, 2009, 09:10 AM
|
|
Registered User
|
|
Join Date: Aug 2009
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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;
}
|

October 6th, 2009, 11:08 PM
|
|
Registered User
|
|
Join Date: Aug 2009
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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?
|

October 8th, 2009, 01:02 AM
|
|
Friend of Wrox
|
|
Join Date: Mar 2007
Location: Hyderabad, A.P., India.
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
|
|
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();">
|

October 8th, 2009, 04:51 AM
|
|
Registered User
|
|
Join Date: Oct 2009
Location: China
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
__________________
Hebei Nanhao Information Industry Co., Ltd.
(largest manufacturer of OMR scanner in China)
Tel: 0086-318-2335036
Fax: 0086-318-2335002
websit: omrchina.com
MSN: amandaqijin(at)hotmail.com
Mail: amandaboard(at)yeah.net
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |