Avatar

Expand-Image without JavaScript (Technics)

by Alfie ⌂, Vienna, Austria, Saturday, March 24, 2007, 12:52 (6236 days ago) @ Alex

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?

According to SELFHTML also for XHTML 1.0


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.

Just a matter of taste ;-)

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.

On one hand yes, but on the other hand it simply blows up the code.

--
Cheers,
Alfie (Helmut Schütz)
BEBA-Forum (v1.8β)

locked
17690 views

Complete thread:

 RSS Feed of thread