Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

animated phases

Status
Not open for further replies.

loveday

Programmer
Sep 19, 2004
106
US
The code below displays various phases of a project and then animates the currently selected project phase.

I also want to have a finger point up to the currently animated project phase.

That is where I am having problem right now.

The line of code:
Code:
    <SPAN style="display: none;" ID="arrow<%=id%>"><IMG SRC="point.gif"></SPAN>

is intended to accomplish 2 things.

1, automatically assing point.gif to each project phase,
2, hide all point.gif images only showing a gif for the currently animated project phase.

So far, the only thing seems to work is the fact the point.gif images are all hidden

Below is the code. Any help in pointing out what I am missing will be appreciated.
Code:
<HTML>
<BODY bgcolor=lavender>
<Center><h3>PROJECT PHASES</3></CENTER><br><br>
<TABLE CellPadding=10>
<TR>
<%
Set DataConnection=Server.CreateObject("ADODB.Connection")
DataConnection.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"DATA SOURCE=" & server.mappath("PROJECT.mdb")
sql = "SELECT phaseID, strProduct FROM Phases ORDER BY phaseID"
set RS = DataConnection.Execute(sql)

Do Until RS.EOF
    id = RS("phaseID")
%>
    <TD ID="p<%=id%>" align=center valign=center>
    <IMG SRC="phase<%=id%>.jpg"><BR/>
    <%=RS("strProduct")%><BR/>
    <SPAN style="display: none;" ID="arrow<%=id%>"><IMG SRC="point.gif"></SPAN>
    </TD>
<%
 RS.MoveNext()
loop
RS.Close
%>
</TABLE>

<SCRIPT Language=JavaScript>
// use phase number passed in via querystring:
var selectedPhase = <%=CINT(Request("phaseID"))%>;
//document.getElementById("arrow"+selectedPhase).style.display = "inline";
var blinker = 256;

function blink( )
{
    var cell = document.getElementById("p" + selectedPhase);
    blinker += 32;
    if ( blinker > 255 ) blinker = 128;
    var hex = ( blinker + 256 ).toString(16);
    cell.style.backgroundColor = "#" + hex.substring(1) + "0000";
    setTimeout( "blink()", 100 );
}
// get things started
blink( );
</SCRIPT>
</BODY></HTML>

Thanks all,
 
var cell = document.getElementById("p" + selectedPhase);

You are giving the span an ID of "arrow" + selectedPhase...

change "p" to "arrow" or vice-versa

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rick Cook (No, I'm not Rick)

zen.gif
 
I have got it working now

I actually had to do an if conditional statement

Code:
<% If CINT(Request("phaseID")) = id Then %><IMG SRC="point.gif"><br><font color="ffffff">You are here</font><% end if %>

var cell = document.getElementById("p" + selectedPhase);

this snippet only works to animate currently selected phase.

Thanks for your help, though
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top