1
기술에서 작동하지 않습니다 : - Asp.Net 2.0자바 스크립트가 사용 모질라에서 작업하지만, 다른 브라우저의 경우
코드 : -
설명은 아래를 참조하십시오 : - 아래 안녕 코드는 IE와 다른에서 잘 작동하지만, 모든 mozila에서 작동하지 않습니다. version.javascript는 두 개의 텍스트 상자 값을 분리하는 것이 간단합니다. 당신은 쉽게 이해할 수 있습니다.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="javascript_test.aspx.cs" Inherits="javascript_test" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<script type ="text/jscript">
var _txtamount;
var _txtins;
var _txtinsamount;
function test()
{
var temp;
_txtamount = document.getElementById("txtamount");
_txtins = document.getElementById("txtins");
_txtinsamount = document.getElementById("txtinsamount");
if (_txtinsamount.value !='')
{
temp = parseFloat(_txtamount.value)/parseFloat(_txtinsamount.value);
}
else
{
temp = 0
}
_txtins.value = temp;
}
</script>
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="myform" runat="server" name="myform">
<div>
<asp:TextBox ID="txtamount" runat="server" ></asp:TextBox>
<asp:TextBox ID="txtinsamount" runat="server" onblur="test();"></asp:TextBox>
<asp:TextBox ID="txtins" runat="server"></asp:TextBox></div>
</form>
</body>
</html>
시도해보십시오.
귀하의
<script>
태그는<head>
요소 또는<body>
요소에 싸여 할 필요가; 그것은 단지<html>
의 직계 자녀 일 수 없습니다.[편집] 여기서 중요한 답변은 "유형"값입니다.
출처
2010-02-22 17:59:32 Pointy
실제로 사양에서 벗어나는 경우 예기치 않은 결과가 발생할 가능성이 더 큽니다. 아니면 그냥 실패. – Dykam
주사위가 없습니다.
관련 문제