View Full Version : Help With Text On Web Page
hungrylilboy
04-08-2004, 11:01 AM
If i put the following into the head section of my webpage it should make the selected text tremble. I have got it working before. Could someone look at it and tell me what i have done wrong this time as it aint working! :helpsmile:
This bit in head section>>>>>>
<style>
.jc{
position:relative;
}
</style>
<script language="JavaScript1.2">
var ns6=document.getElementById&&!document.all
var ie=document.all
var customcollect=new Array()
var i=0
function jiggleit(num){
if ((!document.all&&!document.getElementById)) return;
customcollect[num].style.left=(parseInt(customcollect[num].style.left)==-1)? customcollect[num].style.left=1 : customcollect[num].style.left=-1
}
function init(){
if (ie){
while (eval("document.all.jiggle"+i)!=null){
customcollect[i]= eval("document.all.jiggle"+i)
i++
}
}
else if (ns6){
while (document.getElementById("jiggle"+i)!=null){
customcollect[i]= document.getElementById("jiggle"+i)
i++
}
}
if (customcollect.length==1)
setInterval("jiggleit(0)",80)
else if (customcollect.length>1)
for (y=0;y<customcollect.length;y++){
var tempvariable='setInterval("jiggleit('+y+')",'+'100)'
eval(tempvariable)
}
}
window.onload=init
</script>
And then this bit around the text>>>>
<span id="jiggle1" class="jc">inserted text</span>
Cl1mh4224rd
04-08-2004, 12:46 PM
I don't see any semicolons in that JavaScript code... There should be a semicolon at the end of most of those line.
Try this:
<script language="JavaScript1.2">
var ns6=document.getElementById&&!document.all;
var ie=document.all;
var customcollect=new Array();
var i=0;
function jiggleit(num) {
if ((!document.all&&!document.getElementById)) return;
customcollect[num].style.left=(parseInt(customcollect[num].style.left)==-1)? customcollect[num].style.left=1 : customcollect[num].style.left=-1;
}
function init() {
if (ie) {
while (eval("document.all.jiggle"+i)!=null) {
customcollect[i]= eval("document.all.jiggle"+i);
i++;
}
}
else if (ns6) {
while (document.getElementById("jiggle"+i)!=null) {
customcollect[i]= document.getElementById("jiggle"+i);
i++;
}
}
if (customcollect.length==1) {
setInterval("jiggleit(0)",80);
}
else if (customcollect.length>1) {
for (y=0;y<customcollect.length;y++) {
var tempvariable='setInterval("jiggleit('+y+')",'+'100)';
eval(tempvariable);
}
}
}
window.onload=init;
</script>
hungrylilboy
04-08-2004, 02:06 PM
Originally posted by Cl1mh4224rd@8 April 2004 - 12:46
if ((!document.all&&!document.getElementById)) return;
customcollect[num].style.left=(parseInt(customcollect[num].style.left)==-1)? customcollect[num].style.left=1 : customcollect[num].style.left=-1;
}
*************here***********
function init() {
if (ie) {
while (eval("document.all.jiggle"+i)!=null) {
still doesnt work.
comes up with an error when u try to preview it which says that it expects a ')' in the place where i have mark stars
johannes001
04-08-2004, 08:29 PM
HEAD:
<style>
.jc{
position:relative;
}
</style>
<script language="JavaScript1.2">
var ns6=document.getElementById&&!document.all
var ie=document.all
var customcollect=new Array()
var i=0
function jiggleit(num){
if ((!document.all&&!document.getElementById)) return;
customcollect[num].style.left=(parseInt(customcollect[num].style.left)==-1)? customcollect[num].style.left=1 : customcollect[num].style.left=-1
}
function init(){
if (ie){
while (eval("document.all.jiggle"+i)!=null){
customcollect[i]= eval("document.all.jiggle"+i)
i++
}
}
else if (ns6){
while (document.getElementById("jiggle"+i)!=null){
customcollect[i]= document.getElementById("jiggle"+i)
i++
}
}
if (customcollect.length==1)
setInterval("jiggleit(0)",80)
else if (customcollect.length>1)
for (y=0;y<customcollect.length;y++){
var tempvariable='setInterval("jiggleit('+y+')",'+'100)'
eval(tempvariable)
}
}
window.onload=init
</script>
BODY:
<span id="jiggle0" class="jc"><b>text</a></b></span>
straight from the source SOURCE (http://www.dynamicdrive.com/dynamicindex10/tremble.htm) <_<
hungrylilboy
04-08-2004, 09:40 PM
did u try it? cos i couldnt get it to work
johannes001
04-08-2004, 10:16 PM
Ooops , all that acting smart and got the code wrong myself :ph34r: .
I've put in an extra </a> when copying from the original :rolleyes:
HEAD SHOULD BE:
<span id="jiggle0" class="jc"><b>text</b></span>
Powered by vBulletin® Version 4.2.3 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.