mirror of
https://github.com/neocities/neocities.git
synced 2025-07-22 10:36:07 +02:00
better homework checking for tutorial up to page 6
This commit is contained in:
parent
322a87b1d0
commit
8c5b9a803d
5 changed files with 67 additions and 31 deletions
|
@ -16,14 +16,12 @@
|
|||
<script>
|
||||
function checkHomework() {
|
||||
var html = editor.getValue()
|
||||
var match = '<html.+>.+<body>.+<h1>.+</h1>.+<p>.+</p>.+</body>.+</html>'
|
||||
var re = new XRegExp(match, 'gis')
|
||||
|
||||
if(html.match(re) === null) {
|
||||
notok("That's not right! Try again.")
|
||||
if(html.match(/<p>\S.+<\/p>/) === null) {
|
||||
notok("I don't see a <p>paragraph with text in it</p> anywhere! Try again.")
|
||||
} else {
|
||||
sessionStorage.setItem('tutorialHtml', html)
|
||||
ok('Great, you did it!', '/tutorial/html/5')
|
||||
ok('Great, nice paragraph!', '/tutorial/html/5')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue