Saturday, May 28, 2005

Coldfusion Image Display

I am trying to get an image to display from a path in an msaccess column.

<cfquery name="itemResult" datasource="main_line">
SELECT firstName, phoneID, image, width, height
FROM phone_book
ORDER BY firstName
</cfquery>

<cfoutput query="itemResult">
<img src="../images/#image#" width="#width#" height="#height#">
</cfoutput>

Friday, May 27, 2005

Download From Database To Excel

Ever wonder how to export data from a database and have it open in Excel on the users desktop?

Use this code to get you started.

<cfheader name="Expires" value="#Now()#">
<cfcontent type="application/vnd.ms-excel">
<html><head><title>Untitled</title></head>
<body>
<cfquery datasource="investigatorportal" name="getcodedesc">
select * from code_desc
</cfquery>

<table>
<cfoutput query="getcodedesc">
<tr>
<td>#getcodedesc.code_desc#</td>
</tr>
</cfoutput>
</table>

</body>
</html>

Thursday, May 26, 2005

How To Get Names of Form Fields

Use this code to loop over a form to get the form field values:

>cfloop list = "#FORM.FieldName#" index = "ThisField"<
>cfoutput<
The value of FORM.#ThisField# is #Evaluate("FORM." & ThisField)#>br<
>/cfoutput<
>/cfloop<

Wednesday, May 25, 2005

How To Center Vertically and Horizontally With CSS

For the CSS method, this depends on whether you are facing quirks mode or standards mode.

The following centers a table.

table {margin: auto;}

If you are facing quirks mode in IE, then you must apply text-align: center; on the containing block.

div {
text-align: center; /* For IE Quirks and older IE's */
border: 1px solid black;
}

table {
margin: auto; /* For all other browsers */
border: 1px solid black;
}

<div>
<table>
<tr>
<td>test</td>
</tr>
</table>
</div>

Tuesday, May 24, 2005

Add A Close Window Link

<a href="javascript:window.close()">Close Window</a>

Monday, May 23, 2005

How To Turn Off The Squares In Dreamweaver

From the main menu select: View > Grid > Show Grid (Untick this option)

Sunday, May 22, 2005

Scroll Bar Color

Is it possible to control the color of the scroll bar?

Yes you can control the color of the scroll bar. See http://www.maritimewebdesign.com/ for the code in use.

<style>
<!--
body {scrollbar-face-color: #022A52; scrollbar-highlight-color:
#3399FF; scrollbar-3dlight-color:
#CCFFFF; scrollbar-darkshadow-color: #000000; scrollbar-track-color:
#FFFFFF;
scrollbar-arrow-color: #FFFFFF;}
}
// -->
</style>