Wrox Programmer Forums
|
BOOK: Beginning Dreamweaver MX/MX 2004 MX ISBN: 978-0-7645-4404-0; MX 2004 ISBN: 978-0-7645-5524-4
This is the forum to discuss the Wrox book Beginning Dreamweaver MX by Charles E. Brown, Imar Spaanjaars, Todd Marks; ISBN: 9780764544040
Please indicate which version of the book you are using when posting questions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Dreamweaver MX/MX 2004 MX ISBN: 978-0-7645-4404-0; MX 2004 ISBN: 978-0-7645-5524-4 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 19th, 2004, 01:49 PM
Registered User
 
Join Date: Nov 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Colour Picker Ch11 P 388-391

I'm having trouble actually seeing the colour picker. Selecting the colour works and it effects the rest of the site as it should. But i can't see the colour picker! This hasn't really stopped me from progressing but it would be nice to know why. I've tried pasting the code from the .zip file but it still doesn't show up. Is this a browser issue? I have IE6, XP Pro with ISS and MX2004. This is my code:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<%
  If Request.Form("btnSetColor") <> "" Then
    Response.Cookies("BackGroundColor") = Request.Form("txtColor")
    Response.Cookies("BackGroundColor").Expires = Date() + 30
  End If
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<title>GlobalSoccerEvents.com - Your Source for Soccer Events Around the Globe</title>

<%
  Dim sBackgroundColor
  If Len(Request.Cookies("BackgroundColor")) > 0 Then
    sBackgroundColor = Request.Cookies("BackgroundColor")
  Else
    sBackgroundColor = "#FFFFFF"
  End If
  Dim iTheme
  If Len(Request.Cookies("SiteTheme")) > 0 Then
    iTheme = Request.Cookies("SiteTheme")
  Else
    iTheme = 1 ' Our default theme
  End If
 %>
<link href="Styles/mainStyles.css" rel="stylesheet" type="text/css">
<link href="Styles/MainStyles<%=iTheme%>.css" rel="stylesheet"
type="text/css"
</head>

<body style="background-color: <%= sBackgroundColor %>"><table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><img src="Images/logo.gif"></td>
    <td><table border="0" align="right" cellpadding="0" cellspacing="0">
  <tr>
    <td><a href="home.asp" id="home">Home</a></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><a href="events.asp" id="events">Events</a></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
    <td><a href="mysite.asp" id="mysite">My Site</a></td>
     <td>&nbsp;&nbsp;&nbsp;</td>
    <td><a href="login.asp" id="login">Login</a></td>
    <td>&nbsp;&nbsp;&nbsp;</td>
  </tr>
</table>
</td>
  </tr>
</table>

<br>

 <script language="javascript" type="text/javascript">
    var sPageName = '<%=Request.ServerVariables("SCRIPT_NAME")%>';
    sPageName = sPageName.substr(sPageName.lastIndexOf('/') + 1).toLowerCase();

    sPageName = sPageName.substr(0, sPageName.lastIndexOf('.'));
    if (document.getElementById(sPageName))
    {
        document.getElementById(sPageName).style.fontWeigh t = 'Bold';
        document.getElementById(sPageName).style.fontSize = '14pt';
    }
</script><table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td>
      <h2>Change Background </h2>
    </td>
  </tr>
  <tr>
    <td>
    <script language="JavaScript" type="text/javascript">
arrColors = new Array();
arrColors = ([
'FF9999', 'FFFFEF', '66FF99', '00FF66', '99FFFF', '3399FF',
'FF66CC', 'FF00FF', 'FF0000', 'FFFF00', '33FF33', '66FF33',
'00FFFF', '336699', '660099', 'FF33FF', '730D0D', 'EFBD00',
'33FF00', '006666', '0000AA', '6666CC', '990033', 'FF0099',
'660000', 'FF9933', '007700', '00AA00', '0000FF', '0000AA',
'990099', '33CCCC', '220000', '660033', '002200', '001100',
'000077', '000055', '000033', '000099', '001100', '999900',
'999966', '777777', '339999', 'CCCCCC', '000000', 'FFFFFF',])

document.writeln('<table cellpadding="0" cellspacing="2"><tr>');
var q = 0;
for (p=0 ; p < 6 ; p++)
{
  for (i=0 ; i < 8 ; i++)
  {
   document.writeln('<td>');
   document.writeln('<a href="JavaScript:setColor(\'#');
   document.writeln(arrColors[q] + '\');">');
   document.writeln('<span style="background-color:' + arrColors[q] + '">');
   document.writeln('<img src="images/spacer.gif" width="15" height="15"');
   document.writeln('alt="Click to change the background color to ');
   document.writeln(arrColors[q] + '" border="0"></span></a></td>');
   q++;
  }
  document.writeln('</tr><tr>');
}
document.writeln('</tr></table>');

function setColor(sColor)
{
  document.frmSetColor.txtColor.value = sColor;
}
</script>
<form action="changeSiteBackground.asp" method="post" name="frmSetColor">
  <input name="txtColor" type="text" value="">
  <input name="btnSetColor" type="submit" value="Set Color">
</form>
    </td>
  </tr>
  <tr>
    <td align="center"><br>
    <br>
    <br>
    <br>
    <br>
    </td>
  </tr>
</table>
</body>
</html>


Cheers

 
Old November 19th, 2004, 03:06 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Craig,

This is a known issue and has been corrected in the MX 2004 version of the book (more or less).
The code uses code that is not strictly conform the HTML rules. With that code, and a Doc Type defined, the color picker is invisible.

Remove the following line from your code and it should work:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">


Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old November 19th, 2004, 03:35 PM
Registered User
 
Join Date: Nov 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

once again, thank you very much Imar






Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 4: Page 391 - ButtonType VeganMan BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 8 April 20th, 2008 04:35 AM
Error in Code page 388 NadAf BOOK: Ivor Horton's Beginning Visual C++ 2005 0 February 18th, 2008 11:24 PM
ERRATA on page 388 NadAf BOOK: Ivor Horton's Beginning Visual C++ 2005 0 August 15th, 2007 09:40 PM
Changing Fore colour and back colour darrenb Access VBA 2 May 25th, 2007 07:10 AM
Problem using mail() from Ch11 nodster Beginning PHP 2 May 14th, 2007 08:44 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.