html 注册以播放注册表单脚本
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html 注册以播放注册表单脚本相关的知识,希望对你有一定的参考价值。
<script>
var // user info
firstName,
lastName,
emailAddress,
// element references
fname = document.getElementById('fname'),
lname = document.getElementById('lname'),
email = document.getElementById('email'),
reg = document.getElementById('reg'),
login = document.getElementById('login'),
noThanks = document.getElementById('noThanks'),
noThanksMessage = document.getElementById('noThanksMessage'),
regForm = document.getElementById('regForm').
regPass = document.getElementById('regPass'),
regPassword = document.getElementById('regPassword'),
submitRegPassword = document.getElementById('submitRegPassword'),
loginPass = document.getElementById('loginPass'),
loginPassword = document.getElementById('loginPassword'),
submitLoginPassword = document.getElementById('submitLoginPassword');
// decline event listener
noThanks.addEventListener('click', function() {
// show the goodbye message
noThanksMessage.setAttribute('style', 'display:block;');
});
// register event listener
reg.addEventListener('click', function() {
// here you would want to validate the field values
//
// show the create password form
regPass.setAttribute('style', 'display:block;')
});
// login event listener
login.addEventListener('click', function() {
// here you would want to validate the field values
//
// show the create password form
loginPass.setAttribute('style', 'display:block;')
});
// registration password event listener
submitRegPassword.addEventListener('click', function() {
// here you would want to validate the field values
firstName = fname.value;
lastName = lname.value;
emailAddress = email.value;
password = regPassword.value;
// here you would submit the information to your
// backend registration system
// invoke the function on the parent page to play the video
parent.playVideo();
});
// login password event listener
submitLoginPassword.addEventListener('click', function() {
// here you would want to validate the field values
firstName = fname.value;
lastName = lname.value;
emailAddress = email.value;
password = loginPassword.value;
// here you would submit the information to your
// backend authentication system
// if authentication succeeded,
// invoke the function on the parent page to play the video
parent.playVideo();
});
</script>
以上是关于html 注册以播放注册表单脚本的主要内容,如果未能解决你的问题,请参考以下文章