Phiên bản đầy đủ: jsB@nk » » Lưu dữ liệu trong biến
URL: https://www.javascriptbank.com/memory-script.html
Một đoạn mã JavaScript đơn giản dùng để lưu trực tiếp dữ liệu trong câu lệnh Prompt vào biến.
Phiên bản đầy đủ: jsB@nk » » Lưu dữ liệu trong biến
URL: https://www.javascriptbank.com/memory-script.html
<script language="JavaScript">/* THIS SCRIPT CAN BE USED OR DISTRIBUTED AS LONG AS THIS COMMENT STAY`S IN IT.Made by:BabybelPS! This is my first script and i am 11 1/2 years old so dont be expecting the best! Thank`s to Joe Burns and Andree Growney for anotherexellent tutorial!*/// prompting for namevar n=prompt("Hello! What`s your name?","Write it here");// if the prompt was skipped, give the message "not defined"if ( n == "Write it here"){n=("Not defined")}// same here, but now if the user deleted the textif ( n == ""){n=("Not defined")}// create a function named "nam"function nam(name){// this writes the user data in the form fielddocument.you.something.value=name}</script><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
<form name="you"><!-- INPUT NAME is now "something", change it again if you want to, just remember to, again, change the "something" above --><input name="something" value="" size="20"><!-- the button to start everything --><input type="button" value="Click to fill in prompt information" onclick="nam(n)"></form><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->