Jump to content

This topic is 7442 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

As many of you already know, there is no built-in way for FileMaker to alternate table row colours via CDML. I recently needed to do this, so I thought I'd offer my simple-but-easy solution as thanks for the help I've received from these forums. I hope it helps someone else.

In the document head:

<script language="javascript" type="text/javascript>

function alternateRowColors(RecNum) {

if ((RecNum % 2) > 0) {

document.getElementById(RecNum).style.backgroundColor = '#FFFFFF';

} else {

document.getElementById(RecNum).style.backgroundColor = '#CCCCCC';

}

}

</script>

Then, in the HTML code for your table:

<table>

[FMP-Record]

<tr id="[FMP-CurrentRecordNumber]">

<td> ... </td>

etc

</tr>

<script language="javascript" type="text/javascript">alternateRowColors('[FMP-CurrentRecordNumber]')</script>

[/FMP-Record]

</table>

There you go. I can explain how and why it works if requested, but it's probably pretty obvious to most of you.

Cheers,

Kevin Futter

This topic is 7442 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.