Pastie now auto-senses if line-wrap is a bad or good idea. Feedback?
## mark a section (Learn more)
function actionStyleChange(){ // Get the text to change var text = document.getElementById('sample').getElementsByTagName('p'); // Ascertain which button has been pushed and set a new id value accordingly. var newId; if (this.name == 'big'){ newId = 'big'; }else if (this.name == 'bright'){ newId = 'bright'; }else if (this.name == 'soft'){ newId = 'soft'; }else if (this.name == 'dark'){ newId = 'dark'; } else{ newId = ''; } // Apply the chosen style to each paragraph. for (var i=0; i<text.length; i++){ text[i].class = newId; } }
This paste will be private.
From the Design Piracy series on my blog: