Avatar

Expand-Image without JavaScript (Technics)

by Alex ⌂, Saturday, March 24, 2007, 10:19 (6215 days ago) @ Alfie

For XHTML it should read

script type="text/javascript">
<* <![CDATA[ */
document.write(' <a href="#" onclick="ajax_preview(226); return false"
title="Show preview">
<img src="templates/default/images/ajax_preview.png" 
alt="Show preview" width="11" height="11" /></a>')
/* ]]> */
</script>

instead.

Isn't that the way for XHTML 1.1 only?

You also may omit either the 'width' or the 'height' statement of any image

Hm, OK, this would save a little bit of code. Anyway I'm not that much convinced of this practice.

A further improvement would be referring to either a script in the <head> or even an external script, which contains the 'document.write'-stuff. Assignment would just contain the thread's id as a variable.

That's a question of separating code from design (or in this case keeping design issues in the tepmplates): As the ajax preview is also part of the design the HTML structure should IMHO be marked out in the template file.

locked
16796 views

Complete thread:

 RSS Feed of thread