1====== Webcode - Across header ====== 2 3===== Description ===== 4A webcode may be used across several header in order to create a How to for instance. 5In this case: 6 * the TOC should not break 7 * the edit should go to the good location 8 9 10===== Example: How to Steps ===== 11<webcode name="element.style.fontSize" frameborder=0 scrolling=yes > 12==== Define a css stylesheet ==== 13We define a stylesheet to show that the value of ''element.style.fontSize'' is not defined in this case. 14<code css index.css> 15.sheet { font-size: 15px } 16</code> 17==== Create the HTML page ==== 18 * with an inline style 19<code html index.html> 20<p style="font-size: 20px">A p element with the font-size defined inline</p> 21</code> 22 * with a class defined in the sylesheet 23<code html index.html> 24<p class="sheet">A p element with the font-size defined by a stylesheet</p> 25</code> 26==== Retrieve the elements with Javascript ==== 27 * Get all P element 28<code javascript index.js> 29allP = document.querySelectorAll("p"); 30</code> 31==== Output the value of element.style.fontSize for each element ==== 32 * The first ''p'' element will have a element.style.fontSize 33<code javascript index.js> 34console.log("The first p with an inline definition has a fontSize property of "+allP.item(1).style.fontSize); 35</code> 36 * The second will have not 37<code javascript index.js> 38console.log("The second p with a stylesheet definition has an undefined fontSize property "+(typeof allP.item(0).style.fontSize == 'undefined')); 39</code> 40==== Result ==== 41 42</webcode> 43 44