<head>
<title>Date</title>
<script>
function myFunction(){
//Example I passed in 31-02-2013
var timeDate = document.getElementById('date').text;
//Get the first array and second array
var date = { timeDate[0] , timeDate[1] };
if(date < 1 || date > 30)
alert("Invalid date");
}
</script>
</head>
<body>
<p>Date : <input type="text" id="date" ></p>
<input type="button" value=" Check it " onclick="myFunction()">
</body>
我只是使用C++概念來存儲我的字符串變量的第一個數組和第二個數組。 我不知道如何在HTML中存儲數組。 有人可以教我並糾正我嗎?將第一個數組和第二個數組存儲在來自字符串變量的另一個變量中
不是很清楚你在這裏問一下,你需要在HTML中存儲的數據,看看HiddenFields – Sparky 2013-05-12 14:43:46
你爲什麼在語法猜測?如何做一些研究和[學習JavaScript的基礎知識](https://developer.mozilla.org/en-US/learn/javascript)? – 2013-05-12 14:47:32