Javascript/Html problem
2 posters
Page 1 of 1
Javascript/Html problem
- Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Nickname Generator</title>
</head>
<body>
<div id="nickGen" style="width:800px;">
<div id="output" style="border:2px solid #000000; background-color:#0f110f; width:100%; height: 50px;text-align:center;font-family:Courier New; font-size:16px; font-weight:bold;">
</div>
<br />
<input type="text" id="input" name="input" value="" onkeyup="KeyUp()" style="width:100%;border:2px solid;text-align:center;font-size:16px;font-weight:bold;"/>
<div id="colorDrop">
</div>
</div>
<script type="text/javascript">
var hexa =
[
"000000",
"FF0000",
"00FF00",
"FFFF00",
"0000FF",
"00FFFF",
"FF00FF",
"FFFFFF",
"FF7F00",
"7F7F7F",
"BFBFBF",
"BFBFBF",
"007F00",
"7F7F00",
"00007F",
"7F0000",
"7F3F00",
"FF9919",
"007F7F",
"7F007F",
"007fFF",
"7F00FF",
"3399CC",
"CCFFCC",
"006633",
"FF0033",
"B21919",
"993300",
"CC9933",
"999933",
"FFFFBF",
"FFFF7F"
];
function populate ()
{
var optionList = "<form name='listColor'><select onChange='colorSelect(this.options[this.selectedIndex].value)' name='chooseColor' style='font-weight:bold;background-color:#99A099;'><option style='color:#FFFFFF;' value=''>choose color</option>";
for (var i = 0;i<32;i++)
{
key = String.fromCharCode(i+48);
optionList += "<option style='color:#"+hexa[i]+"' value='"+key+"'>"+key+" = "+hexa[i]+"</option>"
}
document.getElementById("colorDrop").innerHTML += optionList + "</select></form><br>";
document.getElementById("input").value = "your^8Name^5Here";
KeyUp();
}
function colorSelect (i)
{
var input = document.getElementById("input");
input.value += "^" + i;
input.focus();
keyUp();
}
function getIndex(char)
{
var ascii = char.charCodeAt(0);
var index = (ascii - 16) % 32;
return index;
}
function KeyUp()
{
var inp = document.getElementById("input").value;
inp = inp.replace(/"/g,"");
var name = inp.split("^");
var nameString = "<font color=#BFBFBF>"+name[0]+"</font>";
for(var i=1;i<name.length; i++)
{
if(name[i].substring(0,1) != "")
{
var index = getIndex(name[i].substring(0,1));
var color = hexa[index]
if(color === undefined)
{
nameString += "<span style='background-color:#FF0000'>^"+index+"</span><font color=#BFBFBF>"+name[i].substring(1)+"</font>"
}else{
nameString += "<font color=#"+color+">"+name[i].substring(1)+"</font>";
}
}else{
nameString += "<font color=#BFBFBF>^</font>"
}
}
document.getElementById("output").innerHTML = nameString;
document.getElementById("input").value = inp;
}
populate();
</script>
</body>
</html>
This code aint working for HTML page. And not in posts. This is a nickname generator for the game Wolfenstein Enemy Territory i really need it for my site.
Lukas320- New Member
- Posts : 3
Reputation : 0
Language : Dutch
Re: Javascript/Html problem
you can create a html page and put in your post link to this page !
or use iframe :
good luck
or use iframe :
- Code:
<iframe src="http://link to your html page"
width="400" height="300" marginwidth="0" marginheight="0"
hspace="0" vspace="0" frameborder="0" scrolling=yes>
</iframe>
good luck
Guest- Guest
Re: Javascript/Html problem
where is the html table thing, i can't find it
alwayzjjlover- New Member
- Posts : 1
Reputation : 0
Language : english
Similar topics
» What's That "Javascript&HTML"?
» [Help] HTML Code JavaScript
» Javascript/Html uploading
» How Do I add a HTML/Javascript to Forum
» HTML javascript does not work!
» [Help] HTML Code JavaScript
» Javascript/Html uploading
» How Do I add a HTML/Javascript to Forum
» HTML javascript does not work!
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum