 |
|
|  |
ÀÚ¹Ù½ºÅ©¸³Æ®·Î º¯¼öó¸®Çϱâ! |
|
|
 ȨÆäÀÌÁö |
19³â Àü |
// test.html
<script>
function checkIt()
{
form = document.fr;
if(!form.a.value)
{
alert("a °ªÀ» Àû¾îÁÖ¼¼¿ä");
form.a.focus();
return false;
}
if(!form.b.value)
{
alert("b °ªÀ» Àû¾îÁÖ¼¼¿ä");
form.b.focus();
return false;
}
return true;
}
</script>
<form name="fr" method="get" action="test2.html" onSubmit="return checkIt()">
a<input type=text name=a> <br>
b<input type=text name=b> <br>
<input type=submit value=Ŭ¸¯>
</form>
=================================================================
// test2.html
<script>
Result = new Array;
val = location.search; // url¿¡¼ ? ºÎÅÍÀÇ ¹®ÀÚ¿
val = val.slice(1); // ù¹®ÀÚ ? ÀÚ¸£±â
val = val.split("&"); // & ¹è¿³ª´©±â
for(i=0;i<val.length;i++)
{
tmp = val[i].split("="); // = ¹è¿³ª´©±â
Result[tmp[0]] = tmp[1];
}
// º¯¼öÃâ·Â
document.write("a °ªÀº "+Result["a"] +"<br> b °ªÀº "+Result["b"]);
</script>
|
|
̵̧ : 292 |
̵̧
¸ñ·Ï
|
|
|  |
|