|
-
November 15th, 2007, 09:16 PM
#1
use combo box change color.
Code:
var authors = new Array(794);
authors[0] = 'SnakeBot';
authors[1] = 'SnakeBot';
authors[2] = 'SnakeBot';
authors[3] = 'Tdvance';
authors[4] = 'SnakeBot';
authors[5] = 'ClueBot';
authors[6] = 'SnakeBot';
authors[7] = 'SnakeBot';
.....
authors[789] = 'SnakeBot';
authors[790] = 'SnakeBot';
authors[791] = 'SnakeBot';
authors[792] = 'SnakeBot';
authors[793] = 'SnakeBot';
var authorList = new Array(15);
authorList[0] = 'Ckatz';
authorList[1] = 'Mqrasi';
authorList[2] = 'Geedubs';
authorList[3] = 'PipepBot';
authorList[4] = 'DumbBOT';
authorList[5] = 'Cosprings';
authorList[6] = 'Formation';
authorList[7] = 'ClueBot';
authorList[8] = '70.21.43.33';
authorList[9] = 'Tdvance';
authorList[10] = 'SnakeBot';
authorList[11] = 'KocjoBot';
authorList[12] = 'Ohnoitsjamie';
authorList[13] = 'Ackers2210';
authorList[14] = 'KnowledgeOfSelf';
function show0(value) {
var x=parseInt(value);
for (var i=0;i<793;++i) {
var obj = document.getElementById("wiki"+i);
if (obj && dur[i] <=x)
obj.style.backgroundColor = "red";
else if (obj && dur[i] >x) {
obj.style.color = "black";
obj.style.backgroundColor = "pink";
}
}
}
function show1(value) {
var x=parseInt(value);
for (var i=0;i<793;++i) {
var obj = document.getElementById("wiki"+i);
if (obj && dur[i] >x)
obj.style.backgroundColor = "green";
else if (obj && dur[i] <=x) {
obj.style.color = "black";
obj.style.backgroundColor = "yellow";
}
}
}
function start_this() {
if(history.previous != history.current) {
windows.location.reload(true);
}
for (var i=0;i<15;i++) {
var x = document.createElement("option");
var y = document.createTextNode(authorList[i]);
x.appendChild(y);
var z = document.getElementById("myauthorlist");
z.appendChild(x);
}
}
</script>
</head>
<body onload="start_this()" class="mediawiki ns-0 ltr page-Music">
<form>(Display with red) Less than: <input type='text' id='req1' />
<input type='button' onclick='show0(document.getElementById("req1").value)' value='days' />
</form>
<form> (Display with green) Great than: <input type='text' id='req2' />
<input type='button' onclick='show1(document.getElementById("req2").value)' value='days' />
</form>
<br></br>
<p>Select the author:</p>
<p>
<select name = "name" size = 1 id = "myauthorlist">
<br></br>
<div id="wiki615" id="globalWrapper">
<div id="wiki604" id="column-content">
<div id="wiki624" id="content">
<a id="wiki245" name="top" id="top"></a>
....
I want to select an item from the box then the change the displaying color.
For ex, once I click 'SnakeBot',since author[0] = 'SnakeBot', therefore the lines with
id="wiki0" will be displayed as "yellow".
Do I have to apply any event?
Last edited by PeejAvery; November 16th, 2007 at 08:53 AM.
Reason: Fixed confusing double post.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|