473,225 Members | 1,306 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,225 software developers and data experts.

Modify script

Below is a script i need to modify to work and its driving me nuts.
Essentially it fades the content of an array. The original script
specified the object name, I tried to modify it to allow an object to
be passed instead as there are two fading areas on the page code
below, to be honest I could see absolutely no reason why but im not
that offay with javascript so this could be down to me.

Deadlines are getting tight on this one so not bothered how its done
but i need to be able to have fading content on the two specified
areas, one statscroller the other newscroller. The second content
array has been setup, news_fcontent, but it not used.

Any help is greatly appreciated.

<script type="text/javascript">
/***********************************************
* Fading Scroller- Dynamic Drive DHTML code library
(www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source
code
************************************************/
var statsdelay = 3000; //set statsdelay between message change
(in miliseconds)
var statsmaxsteps=30; // number of steps to take to change from start
color to endcolor
var stepstatsdelay=50; // time in miliseconds of a single step

//**Note: statsmaxsteps*stepstatsdelay will be total time in
miliseconds of fading effect
var startcolor= new Array(148,189,235); // start color (red, green,
blue)
var endcolor=new Array(0,0,0); // end color (red, green, blue)

var stats_fcontent=new Array();

stats_fcontent[0]='<div class="fading_banner1"><span class="title">'
+ <%= _totalValue %+ '</span><br/><span class="body">of jewellery
valued so far!</span></div>';
stats_fcontent[1]='<div class="fading_banner1"><span class="title">'
+ <%= _totalCustomers %+ '</span><br/><span class="body">customers
now protected!</span></div>';
stats_fcontent[2]='<div class="fading_banner2"><span
class="title">Working in association with</span><br /><br /><img
src="../images/national_association_gsmiths.jpg" alt="National
Association of Goldsmiths" /></div>';

var news_fcontent=new Array();

news_fcontent[0]='<div class="news_item"><div class="news_text">' + <
%= _header1 %+ '<br />' + <%= _body1 %+ '<br /><a href="' + <%=
_href1 %+ '">More....</a></div><span class="image"><img src="' + <%=
_imgSrc1 %+ '" /></span></div>';
news_fcontent[1]='<div class="news_item"><div class="news_text">' + <
%= _header2 %+ '<br />' + <%= _body2 %+ '<br /><a href="' + <%=
_href2 %+ '">More....</a></div><span class="image"><img src="' + <%=
_imgSrc2 %+ '" /></span></div>';
news_fcontent[2]='<div class="news_item"><div class="news_text">' + <
%= _header3 %+ '<br />' + <%= _body3 %+ '<br /><a href="' + <%=
_href3 %+ '">More....</a></div><span class="image"><img src="' + <%=
_imgSrc3 %+ '" /></span></div>';

var _fade_links=1; //should links inside scroller content also fade
like text? 0 for no, 1 for yes.

var _ie4=document.all&&!document.getElementById;
var _DOM2=document.getElementById;
var faderstatsdelay=0;
var _index=0;

stats_changecontent;

/*Rafael Raposo edited function*/
//function to change content
function stats_changecontent(){
if (_index>=stats_fcontent.length)
_index=0
if (_DOM2){

document.getElementById("statscroller").style.colo r="rgb("+startcolor[0]+",
"+startcolor[1]+", "+startcolor[2]+")";

document.getElementById("statscroller").innerHTML= stats_fcontent[_index];
if (_fade_links)
stats_linkcolorchange(1);
stats_colorfade(1, 15);
}
else if (_ie4)
document.all.statscroller.innerHTML=stats_fcontent[_index]
_index++
}

// stats_colorfade() partially by Marcio Galli for Netscape
Communications. ////////////
// Modified by Dynamicdrive.com

function stats_linkcolorchange(step){
var
obj=document.getElementById("statscroller").getEle mentsByTagName("A");
if (obj.length>0){
for (i=0;i<obj.length;i++)
obj[i].style.color=stats_getstepcolor(step);
}
}

/*Rafael Raposo edited function*/
var _fadecounter;
function stats_colorfade(step) {
if(step<=statsmaxsteps) {

document.getElementById("statscroller").style.colo r=stats_getstepcolor(step);
if (_fade_links)
stats_linkcolorchange(step);
step++;
_fadecounter=setTimeout("stats_colorfade("+step+") ",stepstatsdelay);
}else{
clearTimeout(_fadecounter);

document.getElementById("statscroller").style.colo r="rgb("+endcolor[0]+",
"+endcolor[1]+", "+endcolor[2]+")";
setTimeout("stats_changecontent()", statsdelay);

}
}

/*Rafael Raposo's new function*/
function stats_getstepcolor(step) {
var diff
var newcolor=new Array(3);
for(var i=0;i<3;i++) {
diff = (startcolor[i]-endcolor[i]);
if(diff 0) {
newcolor[i] = startcolor[i]-(Math.round((diff/
statsmaxsteps))*step);
} else {
newcolor[i] = startcolor[i]+(Math.round((Math.abs(diff)/
statsmaxsteps))*step);
}
}
return ("rgb(" + newcolor[0] + ", " + newcolor[1] + ", " +
newcolor[2] + ")");
}

if (window.addEventListener)
window.addEventListener("load", stats_changecontent, false)
else if (window.attachEvent)
window.attachEvent("onload", stats_changecontent)
else if (document.getElementById)
window.onload=stats_changecontent
</script>
<div class="header">LATEST NEWS....</div>
<div id="newscroller" class="news_item"/>
<a href="../valuationdays/valuationbooking.aspx"><img src="../images/
book_a_valuation.jpg" alt="Book a valuation" border="0"/></a><br /
><br />
<a href="../valuationdays/searchvaluationdays.aspx"><img src="../
images/locations.gif" alt="Find a valuation" border="0"/></a><br /
><br />
<div id="statscroller" />
Jun 27 '08 #1
5 1410
kidders wrote:
Below is a script i need to modify to work and its driving me nuts.
Why, isn't that what Dynamic *Drive* is for?
[...]
Any help is greatly appreciated.
Ask the people who are responsible for this junk instead. You're welcome.
PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
Jun 27 '08 #2
On 17 Apr, 14:03, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
kidders wrote:
Below is a script i need to modify to work and its driving me nuts.

Why, isn't that what Dynamic *Drive* is for?
[...]
Any help is greatly appreciated.

Ask the people who are responsible for this junk instead. You're welcome.

PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee
What an incredibly helpful reply...
Jun 27 '08 #3
kidders wrote:
[...] Thomas 'PointedEars' Lahn [...] wrote:
>kidders wrote:
>>Below is a script i need to modify to work and its driving me nuts.
Why, isn't that what Dynamic *Drive* is for?
>>[...]
Any help is greatly appreciated.
Ask the people who are responsible for this junk instead. You're welcome.
[...]

What an incredibly helpful reply...
Do you expect me to lie about the quality of the source (double sense) so
that you are satisfied with what you have and continue to cause your users
and yourself all kinds of trouble?
PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
Jun 27 '08 #4
On 17 Apr, 14:10, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:
kidders wrote:
[...] Thomas 'PointedEars' Lahn [...] wrote:
kidders wrote:
Below is a script i need to modify to work and its driving me nuts.
Why, isn't that what Dynamic *Drive* is for?
>[...]
Any help is greatly appreciated.
Ask the people who are responsible for this junk instead. You're welcome.
[...]
What an incredibly helpful reply...

Do you expect me to lie about the quality of the source (double sense) so
that you are satisfied with what you have and continue to cause your users
and yourself all kinds of trouble?

PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm>
No, but im not asking for observations on the source code, i can tell
that myself even though im not offay with javascript. But as this was
already in place and im having to adapt it due to tight deadlines,
plus the fact im not fully familiar with javascript, a solution (be it
the code modified or an alternative) would have been much more helpful
than your sarcy comment.
Jun 27 '08 #5
kidders wrote:
[...] Thomas 'PointedEars' Lahn [...] wrote:
>kidders wrote:
>>[...] Thomas 'PointedEars' Lahn [...] wrote:
kidders wrote:
Below is a script i need to modify to work and its driving me
nuts.
Why, isn't that what Dynamic *Drive* is for?
[...] Any help is greatly appreciated.
Ask the people who are responsible for this junk instead. You're
welcome. [...]
What an incredibly helpful reply...
Do you expect me to lie about the quality of the source (double sense)
so that you are satisfied with what you have and continue to cause your
users and yourself all kinds of trouble? [...]

No, but im not asking for observations on the source code,
Usenet is not there to provide what you asked for.
i can tell that myself even though im not offay with javascript.
I doubt that very much.
But as this was already in place and im having to adapt it due to tight
deadlines, plus the fact im not fully familiar with javascript, a
solution (be it the code modified or an alternative) would have been much
more helpful than your sarcy comment.
So you painted yourself into a corner and blame others for not helping you
out of it.

I have named the place where you are likely to receive help about this code.
Unless you are willing to pay someone for the service, the only alternative
is to learn JavaScript yourself (for example, by reading here; there's also
a FAQ at <http://jibbering.com/faq/>) and to stop full-quoting here.
PointedEars
--
var bugRiddenCrashPronePieceOfJunk = (
navigator.userAgent.indexOf('MSIE 5') != -1
&& navigator.userAgent.indexOf('Mac') != -1
) // Plone, register_function.js:16
Jun 27 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Got2Go | last post by:
Hello, I am trying to come up with a function that will search the source of the page for a specific string. If that string is found, then have it modify specific tags inside of a table and...
4
by: jp.delatorre | last post by:
how to create script that modify xml file sample xml file: <root> <parent name="a" id="1"> <child name="a.a" id="1.1" /> <child name="a.b" id="1.2" /> <child name="a.c" id="1.3" />...
16
by: Philippe C. Martin | last post by:
Hi, I am trying to change the data in a form field from python. The following code does not crash but has no effect as if "form" is just a copy of the original html form. Must I recreate the...
11
by: tlyczko | last post by:
Hello Rob B posted this wonderful code in another thread, http://groups.google.com/group/comp.lang.javascript/browse_thread/thread/c84d8538025980dd/6ead9d5e61be85f0#6ead9d5e61be85f0 I could not...
2
by: Benjamin Rutt | last post by:
I often execute a long-running python script which is a "driver" for my application; it may run for several hours on a large input. Under CPython, is it safe for me to modify the Python script...
3
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I modify the current page in a browser?...
31
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I modify the current browser window?...
1
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I modify the current page in a browser?...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.