Posts Tagged XHTML

How to group items in HTML select menus

Here’s something I learnt last week, just as the title says: how to group items in an (x)HTML select drop down list. This trick, which I’d assumed was done with magic (or rather DHTML or JavaScript trickery), is actually very easy to achieve being straight forward HTML markup.

[Found in a referenced post linked to by Laura Carlson's excellent [webdev] reference pages (subscribe to the list server here)…]

…the secret, as explained by “Web Teacher” here, is simply to wrap the items you want to group  in the select list with

<optgroup label="group_title"> and </optgroup>

Another good point made there is that to make a select list multiple choice you just need to add the attribute multiple="multiple" into the opening select tag (and make it clear to the users that this is the case as well as how to actually select mulitiple items…)

,

No Comments

Avoid HTML validation errors due to your JavaScript

One of the reasons I changed a random content rotation script that was sitting in my <head> tags last month was because this JavaScript failed to validate. I don’t intend to change back – but today I found out the why-for when I came across the same thing happening in two versions of “The Son of Suckerfish”. One wrapped the JavaScript with CDATA tags the other not. That simple. Of course removing the script into its own file would do the trick too.

Don’t forget to wrap up your script tags safely!

<script type="text/javascript"><!--//--><![CDATA[//><!--
PUT YOUR CODE IN HERE
//--><!]]></script>

This applies to all XHTML pages.

, , ,

No Comments

Clean, formatting-free XHTML from Word for posting into blogs and CMSs?

——–

Update 2

Thanks to this great list of open-source apps for Mac OS X there another option to look at: AbiWord. I’ve not tried it yet but it looks set to beat my non-starting attempts with OpenOffice (office Mac is PowerPC without X11). Even better – it seems to state that it can do the job. TBC.

——–

Update

What a difference a day makes

Despite yesterday’s test proving otherwise – today it seems that I can use Paste Special in to GoLive and keep all formatting. Today I can “Paste As” and chose “Cleared HTML (Removes exotic Markup)” over the limited “HTML” option which was all I could do yesterday. Just a few extra non-breaking spaces and p tags for the line breaks – but otherwise perfect unicode for the web.

I think that I may have not been pasting directly from word. Not sure. Anyway this is now the best solution for when I’m about to help update content.
——–
[Posted to the Microsoft Word forum here]

I’ve been searching for a while now and have found no simple solution for this issue. I’m working to set up a CMS (Drupal in this case) and want to find a way to enable the writers – using Word 2004 – to upload their own content, properly styled in clean XHTML.

I want to avoid any extra steps as more steps leads to more chances for errors to creep in. The only formatting needed is semantic content; just HTML body content without extraneous Word Roundtrip information or formatting at all as all design should be defined by using CSS stylesheets.

I just want the basic stuff i.e. h1-h6 headings (defined at the authoring stage, using Word’s standard styles), bold, italics and quality typography (all accents, “curly” quotes and em-dashes) properly encoded into human readable XHTML entities (ie “&” becomes “&”).

I’m worried that I’m going to have to compromise on quality or make, what to my mind should be basic functionality, a laborious and error-prone process…

Does anybody have a solution? Is this doable by hacking/editing the “Word Conversion Options” or “com.microsoft.Word.prefs.plist” files?

[The basic structure: headings and paragraphs; bold; italics and accents (as unicode) can be handled by the CMS's interface thanks to TinyMCE and its Paste From Word function - but this cannot handle typographic features such as proper curly quotes and em-dashes.]

, , , ,

No Comments