5 Replies - 1363 Views - Last Post: 25 November 2013 - 05:50 PM

#1 steph_malcampo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 29-March 13

how to make letters appear sequentially in JSP

Posted 25 November 2013 - 03:41 AM

hi! I made an alphabet table split into two rows (13 letters each row).. letters A upto M on the first row and N upto Z on the 2nd row.. and each letter is colored (the coloring is random and not letter-specific).. well anyway, I need to make one letter appear at a time (every 3 seconds) instead of all letters all at once.. for instance-- only A should appear at first then after 3 seconds, A disappears and B appears then after 3 seconds, C appears and B disappears and so on until Z.. then back to A after Z appears.. how do I do that? what should I add to my code? thank you!

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@page import="java.util.*;" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Alphabet097914FINAL</title>
<meta http-equiv="refresh" content="3">
</head>
<body>
<%  String[] alphabet = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};%>
<%String[] color = {"Blue", "Yellow", "Red", "Orange", "Green", "Violet"};%>
<table border="1">
<tr>
<%for (int id = 0; id<alphabet.length/2; id++) {%>
<font color="<%=color[(int)(6*Math.random())] %>"><td><%= alphabet[id] %></td></font>
<% } %>
</tr>
<tr>
<%for (int id = 13; id<alphabet.length; id++) {%>
<font color="<%=color[(int)(6*Math.random())] %>"><td><%= alphabet[id] %></td></font>
<% } %>
</tr>
</table>
</body>
</html>



Is This A Good Question/Topic? 0
  • +

Replies To: how to make letters appear sequentially in JSP

#2 laytonsdad  Icon User is offline

  • Let it rip!
  • member icon

Reputation: 466
  • View blog
  • Posts: 1,991
  • Joined: 30-April 10

Re: how to make letters appear sequentially in JSP

Posted 25 November 2013 - 08:34 AM

Have you tried to use java's thread.sleep(time)
Docs here

Or were you looking for an example of using Javascript?


On second thought this can't be done on the server prior to sending to the client.

This post has been edited by laytonsdad: 25 November 2013 - 09:37 AM

Was This Post Helpful? 0
  • +
  • -

#3 laytonsdad  Icon User is offline

  • Let it rip!
  • member icon

Reputation: 466
  • View blog
  • Posts: 1,991
  • Joined: 30-April 10

Re: how to make letters appear sequentially in JSP

Posted 25 November 2013 - 09:14 AM

After further research I see you have a seperate thread here that shows you want to do this with Javascript alone.

How much Javascript do you know? Lets start there.
Was This Post Helpful? 0
  • +
  • -

#4 steph_malcampo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 29-March 13

Re: how to make letters appear sequentially in JSP

Posted 25 November 2013 - 05:18 PM

View Postlaytonsdad, on 25 November 2013 - 04:14 PM, said:

After further research I see you have a seperate thread here that shows you want to do this with Javascript alone.

How much Javascript do you know? Lets start there.


I don't have any idea on Javascript :( we haven't taken up Javascript in school yet...
Was This Post Helpful? 0
  • +
  • -

#5 laytonsdad  Icon User is offline

  • Let it rip!
  • member icon

Reputation: 466
  • View blog
  • Posts: 1,991
  • Joined: 30-April 10

Re: how to make letters appear sequentially in JSP

Posted 25 November 2013 - 05:25 PM

This is your final, yes? Are you going above and beyond the assignment?

I ask these questions because I see it risky to start learning Javascript while doing your final project.

Also, what are the requirements of the project?
Was This Post Helpful? 0
  • +
  • -

#6 steph_malcampo  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 29-March 13

Re: how to make letters appear sequentially in JSP

Posted 25 November 2013 - 05:50 PM

View Postlaytonsdad, on 26 November 2013 - 12:25 AM, said:

This is your final, yes? Are you going above and beyond the assignment?

I ask these questions because I see it risky to start learning Javascript while doing your final project.

Also, what are the requirements of the project?


yes, this is my final code except that I lack the code for making the letters appear one-by-one sequentially every 3 seconds.. which I don't know how to do.. like for instance, only A appears at first then after 3 seconds, B appears and A disappears.. then after another 3 seconds, B disappears and C appears and so on until letter Z then A appears again after letter Z..
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1