•
•
•
•
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 375,197 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 2,095 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: 499 | Replies: 2
![]() |
•
•
Join Date: Jan 2008
Location: Bangalore, India
Posts: 327
Reputation:
Rep Power: 0
Solved Threads: 31
•
•
Join Date: Mar 2007
Posts: 7
Reputation:
Rep Power: 0
Solved Threads: 0
I am interested in doing it myself, but I am running into some issues. I really want a drop down menu with room numbers and then another drop down menu with the color i want that room. I found a snippit of code that I am using, and have started tweaking it. The code will follow.
The boxes in my table are just for testing purposes. I have a trial of dreamweaver so I am just playing around with trying to pass different values to the java function I have defined, while using drop down menus.
If this just looks like it is too much work for a simple home project, then I would be interested in any premade software you know of.
EDIT: if you want to test this, the 3 number areas in the code where you can type the hex value of HTML color scheme work.
And here is the javascript:
The boxes in my table are just for testing purposes. I have a trial of dreamweaver so I am just playing around with trying to pass different values to the java function I have defined, while using drop down menus.
If this just looks like it is too much work for a simple home project, then I would be interested in any premade software you know of.
EDIT: if you want to test this, the 3 number areas in the code where you can type the hex value of HTML color scheme work.
<html><head>
<body>
<script type="text/javascript" src="ddcolorposter.js"></script>
<form>
<p>
<label>
<select name="room" id="room">
<option value="colorbox1">Room1</option>
<option value="colorbox2">Room2</option>
</select>
</label>
</p>
#
<input id="room1" onFocus="ddcolorposter.echocolor(this, room)" size="20" type="text" />
<br>
#
<input id="room2" onFocus="ddcolorposter.echocolor(this, 'colorbox2')" size="20" type="text" />
<br>
#
<input id="room3" onFocus="ddcolorposter.echocolor(this, 'colorbox3')" size="20" type="text" />
<br>
#
<input id="room4" onFocus="ddcolorposter.echocolor(this, 'colorbox4')" size="20" type="text" />
</p>
</form>
<table width="200" border="1">
<tr>
<td><span style="background-color: rgb(255, 255, 255);" id="colorbox1" class="colorbox">____</span></td>
<td><span style="background-color: rgb(255, 255, 255);" id="colorbox2" class="colorbox">____</span></td>
<td><span style="background-color: rgb(255, 255, 255);" id="colorbox3" class="colorbox">____</span></td>
<td><span style="background-color: rgb(255, 255, 255);" id="colorbox4" class="colorbox">____</span></td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<p> </p>
</body></html>And here is the javascript:
function executeonload(functionref){
if (window.addEventListener)
window.addEventListener("load", functionref, false)
else if (window.attachEvent)
window.attachEvent("onload", functionref)
else if (document.getElementById)
window.onload=functionref
}
var ddcolorposter={
echocolor:function(inputobj, divID){
this.targetobj=inputobj
this.divobj=document.getElementById(divID)
this.targetobj.onblur=function(){
if (inputobj.value.search(/^[a-zA-Z0-9]{6}$/)!=-1) //if field contains valid hex value
document.getElementById(divID).style.backgroundColor="#"+inputobj.value
}
}
} Last edited by computerman11 : Mar 3rd, 2008 at 1:25 am.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
Similar Threads
- Programming FAQ - Updated 1/March/2005 (Computer Science and Software Design)
- Newbie in IE hell (Site Layout and Usability)
- Program works... now I need to create a function, HELP! (C)
- I want to learn - How to create and use objects. (C#)
- Parameter error for executeNonQuery() (VB.NET)
- My First Website (HTML and CSS)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: "if" suggestions
- Next Thread: createElement wont show table/div


Linear Mode