Tag: css

Construct navigation for your Amazon aStore using php and YUI

Amazon “aStores” are very easy to set up, but you will probably find you want to customize the navigation, particularly if you want to integrate the store into your own site. I’m in the process of doing just that, and decided to construct my own navigation system for the DesignSpace book shop.. The php script that creates the tabs for the store is based on the YUI (Yahoo UI) “Tab View Control” and can be easily adapted to your own site.

This is just a down and dirty approach but it is a good start for you to build from.

Continue reading

Timing Issues and Javascript

Sometimes, when you use javascript to make a change to some element on a page, you will get a Javascript error along the lines of: “element ‘n’ has no properties.” You check your page, and yes, the element is definitely there, and it is definitely named correctly, and your syntax is definitely correct. So where is the problem?

Well, it may be a timing issue. If your script executes before the element targeted by the script has been rendered, it will not find the element. This can particularly be a problem with frames or iframes. The solution is to move the function call to the bottom of the page, after the element has loaded.

Continue reading

Detect browser support for style properties

It is common to use object detection to discriminate between browser capabilities (See Quirksmode: Object Detection.

However, sometimes it is necessary to detect whether or not a browser understands a particular CSS style property, and it is not obvious how to do this.

You can’t test for the existence of the property directly but you can test for the data type of the value of the property. If the data type is anything but “undefined”, the property is understood by the browser.

The example below shows a couple of rows from an automatically generated table of items. Each row has a corresponding editable version which shows up when the “edit” button is clicked. The original, non-editable row is hidden at the same time the editable row is displayed. If “display=’block” is used to display the TR, Safari will render it as a TD. To correct this, “display=’table-row” must be used on browsers that understand it.

Continue reading

When colspan property doesn’t appear to work in Firefox or Safari

When building web applications I often use display styles to show or hide divs or table rows as needed. On one project, I found that the “colspan” property did not seem to work in Firefox or Safari. This was because I had incorrectly used display:block to style the TR element, instead of display:table-row. A demo is below, and the code follows.

Continue reading