HomeArticlesProjectsBlogContact
Articles
Memory Test - Voltage Regulator
Colin Mitchell
Colin Mitchell
Make sure to subscribe to our newsletter and be the first to know the news.
<!-- TODO FIXME: convert this page, fix javascript. -->
<html>
  <head>
    <title>Component Memory Test</title>
    <script language="JavaScript">
      <!-- Begin
      N = navigator.appName.indexOf('Netscape') != -1
      M = navigator.appName.indexOf('Microsoft') != -1

      Vis = new Array()
      Vis[0] = M ? 'hidden' : 'hide'
      Vis[1] = M ? 'visible' : 'show'

      function GetDiv(divId, divY, divX, divW, divH, bCol, visb, zInd) {
        bkCol =
          bCol != '' ? (N ? ' bgColor=' + bCol : ';background:' + bCol) : ''

        DivTyp = M ? '<DIV' : '<LAYER'
        if (M) {
          Styl =
            ' ID=' +
            divId +
            " style='position:absolute;top:" +
            divY +
            ';left:' +
            divX +
            ';width:' +
            divW +
            ';height:' +
            divH +
            bkCol +
            ';visibility:' +
            Vis[visb] +
            ';z-index:' +
            zInd +
            "'>"
        }
        if (N) {
          Styl =
            ' ID=' +
            divId +
            ' top=' +
            divY +
            ' left=' +
            divX +
            ' width=' +
            divW +
            ' height=' +
            divH +
            bkCol +
            ' visibility=' +
            Vis[visb] +
            ' z-index=' +
            zInd +
            '>'
        }
        document.writeln(DivTyp + Styl)
      }
      function EndDiv() {
        M ? document.writeln('</DIV>') : document.writeln('</LAYER>')
      }
      // End -->
    </script>
  </head>
  <body>
    <script language="JavaScript">
      <!-- Begin
      corr = new Array()
      gnum = 0
      score = 0
      ind = 0
      for (rows = 0; rows < 4; rows++) {
        for (cols = 0; cols < 5; cols++) {
          ind++
          corr[ind] = 0
          eval(
            "GetDiv('d" +
              ind +
              "'," +
              rows * 55 +
              ',' +
              cols * 64 +
              ",55,55,'',1,0)"
          )
          document.write(
            '<img src=CctB',
            ind,
            '.gif width=64 height=55 border=0>'
          )
          EndDiv()
          eval(
            "GetDiv('dvTop" +
              ind +
              "'," +
              rows * 55 +
              ',' +
              cols * 64 +
              ",64,64,'',0,1)"
          )
          document.write(
            "<a href='javascript:TestMe(",
            ind,
            ")'><img name = Pix",
            ind,
            ' src=CctB-Cover.gif width=64 height=55 border=1></a>'
          )
          EndDiv()
        }
      }
      GetDiv('Card1', 330, 20, 250, 15, 'silver', 1, 0)
      document.write(
        "<p align=center><font face=Arial color=#FF0000 size=2>Study the components above then <a href='javascript:StartTest()'>Click</a>.</center>"
      )
      EndDiv()
      GetDiv('Card2', 330, 10, 270, 15, 'silver', 0, 1)
      document.write('<p align=center>Uncover the matching component')
      EndDiv()
      GetDiv('TestPix', 245, 100, 64, 80, '', 1, 1)
      document.write('<img src=CctB-Cover.gif name=Try width=64 height=55')
      EndDiv()
      function StartTest() {
        if (M) {
          eval("document.all.Card2.style.visibility = 'visible'")
        }
        if (N) {
          eval("document.layers.Card2.visibility = 'show'")
        }
        for (x = 1; x < 21; x++) {
          if (corr[x] == 0) {
            if (M) {
              eval('document.all.dvTop' + x + ".style.visibility = 'visible'")
            }
            if (N) {
              eval('document.layers.dvTop' + x + ".visibility = 'show'")
            }
          }
        }
        PickRandom()
        document.Try.src = 'CctB' + picked + '.gif'
      }
      function PickRandom() {
        chk = 0
        while (chk == 0) {
          picked = 1 + Math.floor(20 * Math.random())
          if (corr[picked] == 0) {
            chk = 1
            break
          }
        }
      }
      function TestMe(x) {
        gnum++
        if (x == picked) {
          score++
          corr[x] = 1
        }
        if (M) {
          eval('document.all.dvTop' + x + ".style.visibility = 'hidden'")
        }
        if (N) {
          eval('document.layers.dvTop' + x + ".visibility = 'hide'")
        }
        if (gnum > 19) {
          alert('Test over! Score = ' + score)
          for (x = 1; x < 21; x++) {
            corr[x] = 0
          }
          if (score == 20) alert('All correct!')
          gnum = 0
          score = 0
        }
        setTimeout('StartTest()', 1000)
      }
      // End -->
    </script>
  </body>
</html>

Colin Mitchell

Colin Mitchell

Expertise

electronics
writing
PIC-Chips

Social Media

instagramtwitterwebsite

Related Posts

TODO
Transistor Test
© 2021, All Rights Reserved.

Quick Links

Advertise with usAbout UsContact Us

Social Media