•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 455,964 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,607 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 700 | Replies: 1
![]() |
•
•
Join Date: Jul 2006
Location: Middle America
Posts: 173
Reputation:
Rep Power: 3
Solved Threads: 1
Idea: each character of the text will shimmer in varied shades of gray.
Please help debug the code ---
Please help debug the code ---
// this is all in the <head>
<script type="text/javascript">
var timer = null;
colors = new Array(14)
colors[0]="0"
colors[1]="1"
colors[2]="2"
colors[3]="3"
colors[4]="4"
colors[5]="5"
colors[5]="6"
colors[6]="7"
colors[7]="8"
colors[8]="9"
colors[9]="a"
colors[10]="b"
colors[11]="c"
colors[12]="d"
colors[13]="e"
colors[14]="f"
function genHex(){
digit = new Array(2)
color=""
for (j=0;j<3;j++){
digit[j]=colors[Math.round(Math.random()*14)]
color = color+digit[j]+digit[j]+digit[j];
}
return color;
}
function alter() {
var i = Math.round(Math.random() * 15); // 15 is arbitrary
document.getElementById(i).style.color=genHex();
}
function altTimer() {
timer = setInterval("alter();", 200);
}
</script>
<?php
function line($str) {
for($i = 0, $n = 0; $str[$i] != ""; $i++, $n++)
echo ("<span id=\"".$n."\">".$str[$i]."</span>");
}
?>
// and this is in the <body>
<?php
line("this is a line of text");
?>
<script type="text/javascript">
altTimer();
</script>
You need an id on the object you want to make shimmer.
Also. most browsers will not update the screen until the script either ends or pauses execution (as in an alert statement).
You may need to recursively call your function with setInterval
Also. most browsers will not update the screen until the script either ends or pauses execution (as in an alert statement).
You may need to recursively call your function with setInterval
Last edited by MidiMagic : Nov 19th, 2007 at 9:06 pm.
Daylight-saving time uses more gasoline
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- limit text area words (PHP)
- Java Applets (Java)
- Searching a text file (Python)
- How to render a formatted output using HTML? (HTML and CSS)
- Can you treat a graphics mode like text mode? (Assembly)
- Problems using a php generator (PHP)
- ostringstream overloading (C++)
- Using string variables in a label or text box? (VB.NET)
- connect to text file database (Visual Basic 4 / 5 / 6)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Adding Functions to existing code (transitions)
- Next Thread: Java Help



Linear Mode