arquivo Demo.html
<!
<html>
<head>
<meta nome = conteúdo do gerador = Microsoft Visual Studio 7.0>
<Title> </title>
</head>
<idioma do script = javascript>
função onload ()
{
var str = window.dialogarguments;
if (str! = indefinido)
{
var arr = str.split (-);
if (arr.length == 2)
{
frmMain.txtname.value = arr [0];
frmMain.txtamount.value = arr [1];
}
}
}
função onsubmit ()
{
if (frmMain.txtname.value == || frmmAin.txtamount.value ==)
{
alerta (都要填);
retornar falso;
}
caso contrário
{
alerta (quantidade 必须是数字);
frmMain.txtamount.focus ();
frmMain.txtamount.Select ();
retornar falso;
}
outro
{
var odemo = nova demonstração (frmMain.txtname.value, frmMain.txtamount.value);
window.returnValue = odemo;
window.close ();
}
}
Demo de função (nome, quantidade)
{
this.name = nome;
this.amount = valor;
this.toString = function ()
{
Retorne this.name + - + this.amount;
};
this.fromstring = function (str)
{
var arr = str.split (-);
if (str ==)
{
this.name =;
this.amount = 0;
}
caso contrário, se (arr.length == 2)
{
this.name = arr [0];
this.amount = arr [1];
}
outro
{
alerta (格式错误);
retornar falso;
}
};
}
função isdigit (str)
{
for (var i = 0; i <str.Length; i ++)
{
var ch = str.Charat (i);
if (ch <'0' || ch> '9')
{
retornar falso;
}
}
retornar true;
}
</script>
<Body Onload = OnLoad ()>
<nome de forma = frmMain>
<tabela largura = 200 alinhe = centro>
<tr>
<td width = 50> Nome: </td>
<Td> <Tipo de entrada = Nome do texto = txtName Tamanho = 10> </td>
</tr>
<tr>
<td width = 50> quantidade: </td>
<Td> <Tipo de entrada = Nome do texto = Txtamount Tamanho = 10> </td>
</tr>
<tr>
<td align = center> <tipo de entrada = botão onclick = onSubMit () value = 确定> </td>
</tr>
</tabela>
</morm>
</body>
</html>