A
Alex Nitulescu
Hi. I have the following HTML (snip):
_____________________________________________
<body MS_POSITIONING="GridLayout" onload="Init()">
<form id="frmWebServerAdvanced_1Test" method="post" runat="server">
<div id="service" style="behavior:url(webservice.htc)"
onresult="Service_Result()"></div>
°Fahrenheit: <input id="txtFahrenheit">
<input type="Button" value="Convert !" onclick="Button_Click()">
<span id="lblCelsius"></span>
</form>
</body>
_____________________________________________
and the following script:
_____________________________________________
<script language="javascript">
var intCallID=0;
function Init()
{
service.useService("http://localhost/aspnetprojects/vsnet/WebServerAdvanced_1/TemperatureWithBehaviour.asmx?WSDL","TemperatureWithBehaviour");
}
function Service_Result()
{
//If there is an error, and the call came from the call() in init()
if((event.result.error) && (intCallID == event.result.id))
{
//Pull the error information from the event.result.errorDetail
properties
var xfaultcode = event.result.errorDetail.code;
var xfaultstring = event.result.errorDetail.string;
var xfaultsoap = event.result.errorDetail.raw;
alert(xfaultstring);
//Add code to handle specific error codes here
}
//If there was no error, and the call came from the call() in init()
else if((!event.result.error) && (intCallID == event.result.id))
{
//Show the result !
lblCelsius.innertext="The result of the conversion is " +
event.result.value + " °Fahrenheit"
//alert("The result of the conversion is " + event.result.value +
"°Fahrenheit");
}
else
{
alert("Something else fired the event!");
}
}
function Button_Click()
{
intCallID = service.TemperatureWithBehaviour.callService("ToCelsius",
txtFahrenheit.value);
//intCallID = service.TemperatureWithBehaviour.callService("ToCelsius",
87);
}
</script>
_____________________________________________
I have the following two problems -
1. Microsoft JScript runtime error: 'txtFahrenheit' is undefined
If I comment out the line, as above, and enter a fixed value, it works okay.
2. lblCelsius.innertext does not work - it does not complain, but it simply
does not work. However, ALERT works just fine. I obtain
"The result of the conversions is 30.55..." etc
What am I missing here ? I look at the HTML and everything seems to be in
order.
Thank you, Alex.
_____________________________________________
<body MS_POSITIONING="GridLayout" onload="Init()">
<form id="frmWebServerAdvanced_1Test" method="post" runat="server">
<div id="service" style="behavior:url(webservice.htc)"
onresult="Service_Result()"></div>
°Fahrenheit: <input id="txtFahrenheit">
<input type="Button" value="Convert !" onclick="Button_Click()">
<span id="lblCelsius"></span>
</form>
</body>
_____________________________________________
and the following script:
_____________________________________________
<script language="javascript">
var intCallID=0;
function Init()
{
service.useService("http://localhost/aspnetprojects/vsnet/WebServerAdvanced_1/TemperatureWithBehaviour.asmx?WSDL","TemperatureWithBehaviour");
}
function Service_Result()
{
//If there is an error, and the call came from the call() in init()
if((event.result.error) && (intCallID == event.result.id))
{
//Pull the error information from the event.result.errorDetail
properties
var xfaultcode = event.result.errorDetail.code;
var xfaultstring = event.result.errorDetail.string;
var xfaultsoap = event.result.errorDetail.raw;
alert(xfaultstring);
//Add code to handle specific error codes here
}
//If there was no error, and the call came from the call() in init()
else if((!event.result.error) && (intCallID == event.result.id))
{
//Show the result !
lblCelsius.innertext="The result of the conversion is " +
event.result.value + " °Fahrenheit"
//alert("The result of the conversion is " + event.result.value +
"°Fahrenheit");
}
else
{
alert("Something else fired the event!");
}
}
function Button_Click()
{
intCallID = service.TemperatureWithBehaviour.callService("ToCelsius",
txtFahrenheit.value);
//intCallID = service.TemperatureWithBehaviour.callService("ToCelsius",
87);
}
</script>
_____________________________________________
I have the following two problems -
1. Microsoft JScript runtime error: 'txtFahrenheit' is undefined
If I comment out the line, as above, and enter a fixed value, it works okay.
2. lblCelsius.innertext does not work - it does not complain, but it simply
does not work. However, ALERT works just fine. I obtain
"The result of the conversions is 30.55..." etc
What am I missing here ? I look at the HTML and everything seems to be in
order.
Thank you, Alex.