break loop only if count 5 documentwriteln Count is count br

Break loop only if count 5 documentwriteln count is

This preview shows page 20 - 26 out of 26 pages.

// break loop only if count == 5     document.writeln( "Count is: " + count + "<br />" );   }   document.writeln("Broke out of loop at count = " + count );   </script> </head> </html>
Image of page 20
Continue.html 08b - 21 COMP-1536 & ACIT-1620 <!DOCTYPE HTML> <html lang="en"> <head>   <title>JavaScript continue example</title>   <meta charset="utf-8" />   <script>   for ( var count = 1; count <= 10; ++count ) {     if ( count == 5 )       continue;   // skip remaining code in loop only if count == 5              document.writeln( "Count is: " + count + "<br />" );   }   document.writeln( "Used continue to skip printing 5" );   </script> </head> </html> gap
Image of page 21
Accessing HTML elements with JS COMP-1536 & ACIT-1620 08b - 22 document.getElementById("idImg") Access  an object using its id  attribute. Single document.getElementsByTagName("tagName") Access a group of elements using  their common tag names.  Example “span”, “div”, etc… Multiple document.getElementsByName("txt"); Access a group of elements using  their common element names.  Example “txtbox”, “radioGender”,  etc… Multiple document.formBogus.objName; Accessing an input form element  using its name. Single
Image of page 22
getElementById() example COMP-1536 & ACIT-1620 08b - 23 <!DOCTYPE HTML> <html lang="en"> <body style="font-family: Verdana, Arial, Helvetica, sans-serif;">   <div style="position: absolute; background-color: RGB(234,233,29); text-align:  center; width: 100%; height: 60px;">         <br /><span style="color:red; font-family: verdana; font-size: large;">Seker  Food Industries</span>   </div>   <div style="position: absolute;margin-top: 100px; margin-left: 40px;">     <h3>Welcome to Seker Food Industries</h3>      <div id="content">Something</div>   </div>   <script type = "text/javascript">          document.getElementById("content").innerText = "<h1>Happy  Halloween</h1>";   </script> </body> </html> See: getElementById/default.html
Image of page 23
getElementsByTagName() example COMP-1536 & ACIT-1620 08b - 24 <!DOCTYPE HTML> <html lang="en"> <body style="font-family: Verdana, Arial, Helvetica, sans-serif;">   <div style="position: absolute; background-color: RGB(234,233,29); text-align: center; width:  100%; height: 60px;">     <br /><span style="color:red; font-family: verdana; font-size: large;">Seker Food  Industries</span>   </div>   <div style="position: absolute;margin-top: 100px; margin-left: 40px;">     <h3>Welcome to Seker Food Industries</h3>     <div>Something</div>   </div>   <script type = "text/javascript">      var spanArray = document.getElementsByTagName('div');     alert(spanArray[0].innerHTML);      spanArray[2].innerText = "Happy Halloween";   </script> </body> </html> See: getElementsByTagName/default.html
Image of page 24
getElementsByName() example COMP-1536 & ACIT-1620 08b - 25 <?xml version="1.0" encoding="utf-8" ?>  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"    ""> <html xmlns="" xml:lang="en-US" lang="en-US">
Image of page 25
Image of page 26

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture