Right now i have a verifying code here:
<script type="text/javascript">
var i = prompt("Enter The Password: ");
if (i === x) {
window.location.href = '';
}
else {
document.write("PASSWORD INVALID!!!")
}
</script>
and another piece of code is here:
<script> <!-- not the same as above -->
var x = prompt("Choose a password: ");
</script>
I would like to take the value from the 'choose a password' prompt in the second script, in order to create a password on the 'enter the password' prompt. Bascially the x
variable in the second script must be the same as x
variable in the first script. Any suggestions?
If I understand correctly. You can export the 'x' variable from file and import it in the file where you need it.
You can read about imports and exports on MDN ( imports ) or somewhere else, there is a lot of examples on this topic.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.