PDA

View Full Version : Javascript



Braders
03-09-2003, 18:56
i tried the [code] tags with some javascript, but it doesn't work any ideas?

for example something like this:

<script language="JavaScript">
function nextSize(i,incMethod,textLength)
{
if (incMethod == 1) { return (22*Math.abs(Math.sin(i/(textLength/3.14))) );
}
if (incMethod == 2) { return (255*Math.abs(Math.cos(i/(textLength/3.14))));
}
return(0)
}
function sizeCycle(text,method,dis)
{
var output = "";
for (i = 0; i < text.length; i++) {
size = parseInt(nextSize(i +dis,method,text.length));
output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";
}
if (document.all)
theDiv.innerHTML = output;
else if (document.getElementById){
rng = document.createRange();
el = document.getElementById('theDiv');
rng.setStartBefore(el);
htmlFrag = rng.createContextualFragment(output);
while (el.hasChildNodes()) el.removeChild(el.lastChild);
el.appendChild(htmlFrag);}
else if (document.layers){

document.theDiv.document.write("<font face='Arial'point-size=11>"+output+"</font>");
document.theDiv.document.close();}


}


function doWave(n) {
var theText = 'Whose round is it?';

sizeCycle(theText,1,n);
if (n > theText.length) {
n=0
}
setTimeout("doWave(" + (n+1) + ")", 50);
}

</script>



Cheers Lee

hack_the_planet
04-09-2003, 16:40
At what point is the code failing?

Braders
04-09-2003, 18:40
It doesn't even load it's as if the [code] tags aren't being recognized.

When i tried it in the past with a few other scripts as well all i got was a post of the script instead of my signature....

Teutonic Deity
05-09-2003, 01:42
For security reasons, javascript (and even html) will not run in the forums environment. Instead, a fairly benign analog of html called vB Code (http://www.expat.ru/forum/misc.php?action=bbcode) is used for various text formatting options.

hack_the_planet
05-09-2003, 09:10
Sorry Lee.....I didnt realise you was trying to run the code on this site...