Rajar Ahmed
asked on
JavaScript - Marquee Problem
Now its starting from the beginning of the text on every page redirection is there a way to continue to next page where it left on the previous page....??
<MARQUEE scrollAmount=4 direction="left">
Hi
this Text should be continued where it left from the page on
redirection . But now Starting from beginning . How can i do this ??
</MARQUEE>
<MARQUEE scrollAmount=4 direction="left">
Hi
this Text should be continued where it left from the page on
redirection . But now Starting from beginning . How can i do this ??
</MARQUEE>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
hi any ,
srry i cant use frames as it leads to lot of changes in the project...!
hi gurvinder .
Even i thought something like that , but i havent had my hand on code in marquee ..so bit strange how to do this ...
?can u present a small eg ... will be more helpfull
Thanks
Meeran 03 :)
srry i cant use frames as it leads to lot of changes in the project...!
hi gurvinder .
Even i thought something like that , but i havent had my hand on code in marquee ..so bit strange how to do this ...
?can u present a small eg ... will be more helpfull
Thanks
Meeran 03 :)
Gurvinder, no need to speed it up, if you can figure out how much of the text that has passed, chop that off and stick it onto the end of the string in the marquee
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
i tried like this .. created two html page ... onclick i get the value of textpassed with ur js ..
but am getting pageLoadTime is undefined error ..is am on right path ??
but am getting pageLoadTime is undefined error ..is am on right path ??
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="javascript">
//you can fetch the marquee speed by
function text()
{
var scrollAmount = document.getElementById('Marque1').scrollamount ;
//you can fetch the time elapsed by
var timeElapsedInSeconds = ((new Date()).getMilliseconds() - pageLoadTime.getMilliseconds())/60;
//you can fetch the amount of text scrolled passed,
var textLengthScrolled = ( scrollAmount * timeElapsedInSeconds ) % marqueeText.length;
alert(textLengthScrolled);
}
</script>
</head>
<body>
Test 2 PAge
<MARQUEE scrollAmount=4 id="Marque1" direction="left">
Hi this Text should be continued where it left from the page on
redirection . But now Starting from beginning . How can i do this ??
</MARQUEE>
<a href="test1.html" onclick="return text()">Marquee Text</a>
</body>
</html>
Second page
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script>
//you can fetch the marquee speed by
function text()
{
var scrollAmount = document.getElementById('Marque1').scrollamount ;
//you can fetch the time elapsed by
var timeElapsedInSeconds = ((new Date()).getMilliseconds() - pageLoadTime.getMilliseconds())/60;
//you can fetch the amount of text scrolled passed,
var textLengthScrolled = ( scrollAmount * timeElapsedInSeconds ) % marqueeText.length;
alert(textLengthScrolled);
}
</script>
</head>
<body>
Hi this Test1 Page
<MARQUEE scrollAmount=4 id="Marque1" direction="left">
Hi this Text should be continued where it left from the page on
redirection . But now Starting from beginning . How can i do this ??
</MARQUEE>
<a href="test2.html" onclick="return text()">Marquee Text</a>
</body>
</html>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi mplungjan,
i still get the pageLoadTime is undefined error ..
and am not getting that string if i checked in alert box also ,
And again the page 2 is starting from the begining .
Thanks
<input id="gwProxy" type="hidden"><!--Session data--><input onclick="jsCall();" id="jsProxy" type="hidden">
i still get the pageLoadTime is undefined error ..
and am not getting that string if i checked in alert box also ,
And again the page 2 is starting from the begining .
Thanks
<input id="gwProxy" type="hidden"><!--Session data--><input onclick="jsCall();" id="jsProxy" type="hidden">
Page 1 :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="javascript">
//you can fetch the marquee speed by
function text()
{
var scrollAmount = document.getElementById('Marque1').scrollamount ;
//you can fetch the time elapsed by
var timeElapsedInSeconds = ((new Date()).getMilliseconds() - pageLoadTime.getMilliseconds())/60;
//you can fetch the amount of text scrolled passed,
var textLengthScrolled = ( scrollAmount * timeElapsedInSeconds ) % marqueeText.length;
alert(textLengthScrolled);
return textLengthScrolled;
}
</script>
</head>
<body>
Test 2 PAge
<MARQUEE scrollAmount=4 id="Marque1" direction="left">
Hi this Text should be continued where it left from the page on
redirection . But now Starting from beginning . How can i do this ??
</MARQUEE>
<a href="test1.html" onclick="this.href='test1.html?'+text()">Marquee Text</a>
</body>
</html>
Page 2 :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script>
function hi()
{
var text = document.getElementById('Marque1').innerHTML;
var from = location.search.substring(1)
var part1 = text.substring(from);
var part2 = text.substring(0,from);
document.getElementById('Marque1').innerHTML=part1+part2;
}
</script>
</head>
<body onload="return hi()">
<MARQUEE scrollAmount=4 id="Marque1" direction="left">
Hi this Text should be continued where it left from the page on
redirection . But now Starting from beginning . How can i do this ??
</MARQUEE>
</body>
</html>
youneed to do a
var pageLoadTime=new Date()
var pageLoadTime=new Date()
ASKER
This is always returning zero ??
((new Date()).getMilliseconds() - pageLoadTime.getMillisecon ds())/60;
so unable to find text length scrolled ..
((new Date()).getMilliseconds() - pageLoadTime.getMillisecon
so unable to find text length scrolled ..
pageLoadTime = new Date(); should be done at the page load time, and you should make sure that this variable is not updated again later.
make it a global variable, but initialize it only in the onload event on the body and never again
make it a global variable, but initialize it only in the onload event on the body and never again
As in (not tested)
<script language="javascript">
var pageLoadTime = new Date(); // in case someone clicks before finished loading
//you can fetch the marquee speed by
function text() {
var scrollAmount = document.getElementById('Marque1').scrollamount ;
//you can fetch the time elapsed by
var timeElapsedInSeconds = ((new Date()).getMilliseconds() - pageLoadTime.getMilliseconds())/60;
//you can fetch the amount of text scrolled passed,
var textLengthScrolled = ( scrollAmount * timeElapsedInSeconds ) % marqueeText.length;
return textLengthScrolled;
}
window.onload=function() {
pageLoadTime = new Date(); // this is what we need later
}
</script>
ASKER
on alert(textLengthScrolled); during testing
i get NAN as result why it so ??
i get NAN as result why it so ??
<script language="javascript">
var pageLoadTime = new Date(); // in case someone clicks before finished loading
//you can fetch the marquee speed by
function text() {
var scrollAmount = document.getElementById('Marque1').scrollAmount ;
//you can fetch the time elapsed by
var timeElapsedInSeconds = ((new Date()).getMilliseconds() - pageLoadTime.getMilliseconds())/60;
//you can fetch the amount of text scrolled passed,
var textLengthScrolled = ( scrollAmount * timeElapsedInSeconds ) % Marque1.length;
alert(textLengthScrolled);
return textLengthScrolled;
}
window.onload=function() {
pageLoadTime = new Date(); // this is what we need later
}
</script>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
hi mplunjian ,
oopss......i want to continue from where it left .. this is removing all the character which scrolled in previous page.....i understand d difficulty of this task ...
but we require like that . !
oopss......i want to continue from where it left .. this is removing all the character which scrolled in previous page.....i understand d difficulty of this task ...
but we require like that . !
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Yes something like this:
<script language="javascript">
var pageLoadTime = new Date(); // in case someone clicks before finished loading
//you can fetch the marquee speed by
function text() {
var Marque1 = document.getElementById('Marque1');
var text = Marque1.innerHTML
var scrollAmount = Marque1.scrollAmount ;
//you can fetch the time elapsed by
var timeElapsedInSeconds = ((new Date()).getMilliseconds() - pageLoadTime.getMilliseconds())/60;
//you can fetch the amount of text scrolled passed,
var textLengthScrolled = ( scrollAmount * timeElapsedInSeconds ) % text.length;
alert(textLengthScrolled);
return textLengthScrolled;
}
window.onload=function() {
pageLoadTime = new Date(); // this is what we need later
var text = document.getElementById('Marque1").innerHTML;
var from = location.search.substring(1)
var part1 = text.substring(from);
var part2 = text.substring(0,from);
document.getElementById('Marque1").innerHTML=part1+part2;
}
</script>
ASKER
this code .is doing but ..
marquee starts from here ...:( but requirement is not like that...!!
i agree the coding is such a way done .. i stick to my marquee text in the question posted.
Combined both the experts code ......
var from = location.search.substring( 1)
if from =3
//var part_real= cycleChars(text, from) (In code )
result is
his Text should be continued where it left from the page on redirection . But now Starting from beginning . How can i do this ??Hi t
but all i need is ...
this should be already opened and then it should get scrolled after this ...
Hi this get marquee like this ... i agree the coding is such a way done .. but all i need is ...
his Text should be continued where it left from the page on redirection . But now Starting from beginning . How can i do this ??
marquee starts from here ...:( but requirement is not like that...!!
i agree the coding is such a way done .. i stick to my marquee text in the question posted.
Combined both the experts code ......
var from = location.search.substring(
if from =3
//var part_real= cycleChars(text, from) (In code )
result is
his Text should be continued where it left from the page on redirection . But now Starting from beginning . How can i do this ??Hi t
but all i need is ...
this should be already opened and then it should get scrolled after this ...
Hi this get marquee like this ... i agree the coding is such a way done .. but all i need is ...
his Text should be continued where it left from the page on redirection . But now Starting from beginning . How can i do this ??
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script>
function hi()
{
pageLoadTime = new Date(); // this is what we need later
var text = document.getElementById('Marque1').innerHTML;
var from = location.search.substring(1)
var part1 = text.substring(from);
var part2 = text.substring(0,from);
var part_real= cycleChars(text, from)
document.getElementById('Marque1').innerHTML=part_real;
}
function cycleChars(text, numberOfChars)
{
var tmpText1 = text.substring(0,numberOfChars);
var tmpText2 = text.substring(numberOfChars);
var text= tmpText2+tmpText1;
return text;
}
</script>
</head>
<body onload="return hi();">
Test 2 PAge
<MARQUEE scrollAmount=4 id="Marque1" direction="left">
Hi this Text should be continued where it left from the page on
redirection . But now Starting from beginning . How can i do this ??
</MARQUEE>
<a href="marquee_text.html" onclick="return text()">Marquee Text</a>
</body>
</html>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
hi mplungjan,
welll its okayy ...
is it possible to do wat am asking ??
welll its okayy ...
is it possible to do wat am asking ??
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
hi mplungjan,
my apologies for calling ur name wrongly
Meeran03
my apologies for calling ur name wrongly
Meeran03
@meeran03: Thanks for the points. Could you please post the solution/source code which has resolved your problem.
Thanks again
Thanks again
http://www.w3schools.com/tags/tag_frameset.asp
Keep the Marquee in a separate frame and all the pages that load in another frame of a main page.