better homework checking for tutorial up to page 6

This commit is contained in:
Kyle Drake 2016-04-17 14:33:23 -07:00
parent 322a87b1d0
commit 8c5b9a803d
5 changed files with 67 additions and 31 deletions

View file

@ -4,10 +4,10 @@
<!-- Check out your site at <a href="">victoria.neocities.org</a>. -->
</div>
<div class="dialogue" style="left: 300px; top: 25px; width: 250px">
Let's make your name a heading by putting a <strong>Heading Level 1 tag</strong> around it.
Let's make your name a heading by putting the <strong>h1 tag</strong> around it. This helps to visually separate content on your site.
</div>
<div class="dialogue" style="left: 330px; top: 120px; width: 250px">
Change the text to this: <strong><span id="answer"></span></strong>
Try using an h1 tag by changing the text to something like this: <strong><span id="answer"></span></strong>
and click save.
</div>
</div>
@ -29,20 +29,16 @@
</div>
<script>
var answer = '<h1>'+sessionStorage.getItem('name')+"'s Website</h1>"
$('#answer').text(answer)
function checkHomework() {
var html = editor.getValue()
var match = '<html.+>.+<body>.+'+answer+'.+</body>.+</html>'
var re = new XRegExp(match, 'gis')
if(html.match(re) === null) {
notok("That's not right! Try again.")
if(!html.match(/<h1>\S.+<\/h1>/)) {
notok("That doesn't look like a header! Try again.")
} else {
sessionStorage.setItem('tutorialHtml', html)
ok('Great, you did it!', '/tutorial/html/4')
ok('Nice header!', '/tutorial/html/4')
}
}
</script>