I wanted to choose a new background colour for my web page and although there are several web pages devoted to this I thought it could be done a better way. I chose to increment the colour value by 3 at a time. By : AndyC <?php print "<html>"; print "<body>"; print "<h1><center>Background colours</center></h1>"; print "<table border='1' align='center'>"; $pos = 1; $tabcol = 0; $col1 = 0; $col2 = 0; $col3 = 0; $col4 = 0; $col5 = 0; $col6 = 0; $xcolour = "0123456789ABCDEF"; //loop statement(line) while ($col1 + $col2 + $col3 + $col4 +$col5 + $col6 < 90) { if ($tabcol == 0) { print "<tr>"; } $tabcol = $tabcol + 1; $xcellcol = '#'.substr($xcolour,$col1,1).substr($xcolour,$col2,1).substr($xcolour,$col3,1).substr($xcolour,$col4,1).substr($xcolour,$col5,1).substr($xcolour,$col6,1); // print "<td width='10%' bgcolor='$xcellcol'>$xcellcol</td>"; print "<td width='10%' bgcolor='$xcellcol'>"; if ($col1 + $col3 + $col5 < 24) { print "<font color='FFFFFF'>"; } print "$xcellcol</td>"; $col6 = $col6 + 3; if ($col6 >15) { $col5 = $col5 + 3; $col6 = 0; if ($col5 >15) { $col4 = $col4 + 3; $col5 = 0; if ($col4 >15) { $col3 = $col3 + 3; $col4 = 0; if ($col3 >15) { $col2 = $col2 + 3; $col3 = 0; if ($col2 >15) { $col1 = $col1 + 3; $col2 = 0; } } } } } if ($tabcol > 5) { $tabcol = 0; print "</tr>"; } } print "</table>"; print "</body>"; print "</html>"; ?> | DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |
More GUI Code Articles More By Codewalkers developerWorks - FREE Tools! | As businesses grow increasingly dependent upon Web applications to provide services to customers, employees and partners, these complex applications become more difficult to secure. Although traditional security solutions protect Internet infrastructure layers, they do not guard against HTTP and HTML attacks. Many organizations that conduct security testing still deploy applications that allow attackers to manipulate their logic and wreak havoc on their business. To mitigate this risk, development and delivery teams must address Web application security throughout the lifecycle, addressing the many layers detailed in this paper. FREE! Go There Now!
| | | | Download the Rational Application Developer (RAD) v7.5 open beta code and start developing applications for the JEE5 standard which features EJB3.0, JPA, JSF 1.2, JSP 2.1 and Servlet 2.5 standards. When you use this beta you will see how you can increase developer productivity for already existing applications with improved support for refactoring, as well as adding new features to existing applications. In addition, the beta provides tooling for JD Edwards, Oracle, SAP, Siebel and PeopleSoft to improve the developer productivity with these enterprise systems. FREE! Go There Now!
| | | | In this webcast, you'll get an introduction to the eXtreme Transaction Processing (XTP) features of WebSphere Extended Deployment and the common architectural traits required by XTP applications. See how WebSphere Extended Deployment's ObjectGrid feature provides a state-of-the-art infrastructure for hosting XTP applications. FREE! Go There Now!
| | | | Join this Rational Talks to You teleconference on December 6 at 1:00 pm ET to participate in an agile application development discussion and get your questions answered on using IBM Rational Method Composer in a distributed environment.Get your questions answered! FREE! Go There Now!
| | | | Learn the basics of the IBM Customer Information Control System (CICS). With a hands-on exercise, learn how to get your first CICS application up and running on your desktop using TXSeries V6.1 for Windows. The tutorial shows you how to download and install a free trial version of TXSeries V6.1. FREE! Go There Now!
| | | | Discover how Rational tools and best practices for testing can make your job easier. The new Rational Testing eKits provide you with valuable resources – including demos, webcasts, tutorials, and articles – that help you address your specific testing needs across the software lifecycle. Five new eKits are available covering the topics of Requirements and Test Management, Functional Testing, Performance Testing, Code Quality and Embedded Systems, and SOA and Web Services Testing. FREE! Go There Now!
| | | | Effective governance for lean development isn’t about command and control. Instead, the focus is on enabling the right behaviors and practices through collaborative and supportive techniques. Hear from Scott Ambler on how it is far more effective to motivate people to do the right thing than it is to force them to do so. Learn how to form a lightweight, collaboration-based framework that reflects the realities of modern IT organizations. FREE! Go There Now!
| | | | Join this Rational Talks to You teleconference on November 29 at 1:00 pm ET to participate in an interactive discusssion with Grady Booch around architecture and reuse. Get your questions answered! FREE! Go There Now!
| | | | Visit IBM developerWorks to download a free trial version of Lotus Quickr 8.0, which enables collaboration by transforming the way everyday business content such as documents, rich media, photos, and video can be shared. Lotus Quickr makes it faster and easier to share content of all types (not just documents) within virtual teams. It is designed to make it easier to collaborate across organizational boundaries, while continuing to work within the context of familiar desktop applications. FREE! Go There Now!
| | | | As organizations integrate software into every aspect of business, they are constantly pressured to deliver faster, better, and cheaper results. Unfortunately, a “dis-integrated” software delivery approach reduces returns while increasing costs. This IBM Rational White Paper shows how Integrated Requirements Management aligns organizations around maximizing value and keeping pace with change. FREE! Go There Now!
| | | | All FREE IBM® developerWorks Tools! | |