473,473 Members | 1,881 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

WebServer "Behavior" question

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","TemperatureWi thBehaviour");
}

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("ToCe lsius",
txtFahrenheit.value);
//intCallID = service.TemperatureWithBehaviour.callService("ToCe lsius",
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.
Nov 19 '05 #1
2 1229
"Alex Nitulescu" <RE***********************@yahoo.com> wrote in message news:%2******************@TK2MSFTNGP10.phx.gbl...
intCallID = service.TemperatureWithBehaviour.callService("ToCe lsius", txtFahrenheit.value); : : 1. Microsoft JScript runtime error: 'txtFahrenheit' is undefined
Double check (a) you don't have a typo, and (b) txtFahrenheit has a value,
as it works for me. If nothing else occurs to you, try rummaging through
document.all to retrieve the IHTMLElement by it's id attribute value like
this [unverified],

intCallID = service.TemperatureWithBehaviour.callService( "ToCelsius",
document.all["txtFahrenheit"].value);

or look at what Visual Studio .NET debugger tells you when you put
txtFahrenheit into the Watch window during a debug session.
2. lblCelsius.innertext does not work - it does not complain, but it simply does not work.


It's always permissible to add an extra attribute on a client-side DOM element.
Whether the browser interprets the attribute you've invented is another matter.

Use

lblCelsius.innerText = "The result of the conversion is " + event.result.value + " °Fahrenheit";

instead (note the camel case).
Derek Harmon
Nov 19 '05 #2
Fantastic :-))))

1. It was innerText, not innertext !
2. For some (very obscure to me) reason,
intCallID = service.TemperatureWithBehaviour.callService("ToCe lsius",
document.all["txtFahrenheit"].value);
works, but
intCallID = service.TemperatureWithBehaviour.callService("ToCe lsius",
txtFahrenheit.value);
doesn't - it says that 'txtFahrenheit' is undefined.

(Even the debugger says the same thing - that 'txtFahrenheit' is undefined.
However, when I tried with document.all["txtFahrenheit"].value, it showed my
value (32) correctly. Hmmmmm......)

Something else, please, I see that you're *very* knowledgeable, if I may:

1. If I have another webservice which returns an image (a jpeg) as a byte
array (and it works fine), how could I show the picture in a frame (or, even
better, in a "img" element) ? Right now I have the code:

Dim objBinaryWebService As New localhost.ImagesWebService()

Response.Clear()
Response.ClearHeaders()
Response.ContentType = "image/jpeg"
Response.BinaryWrite(objBinaryWebService.GetRandom Image)
objBinaryWebService.Dispose()

which works, but all my controls on the form are not even considered,
because of the Content-Type, I assume. My intent is to use this to show
random thumbnails of the "Products" in the Products table - so I plan to
stop using the web reference but use a behaviour instead, and use
setInterval("GetRandomImage()",5000) to change the images every 5 secs !

2. A simpler one - will this code I'm fighting with right now work with
Mozilla ?

Thanks again ! :-)))

Alex.


"Derek Harmon" <lo*******@msn.com> wrote in message
news:uV**************@TK2MSFTNGP15.phx.gbl...
"Alex Nitulescu" <RE***********************@yahoo.com> wrote in message
news:%2******************@TK2MSFTNGP10.phx.gbl...
intCallID = service.TemperatureWithBehaviour.callService("ToCe lsius",
txtFahrenheit.value);

: :
1. Microsoft JScript runtime error: 'txtFahrenheit' is undefined


Double check (a) you don't have a typo, and (b) txtFahrenheit has a value,
as it works for me. If nothing else occurs to you, try rummaging through
document.all to retrieve the IHTMLElement by it's id attribute value like
this [unverified],

intCallID = service.TemperatureWithBehaviour.callService( "ToCelsius",
document.all["txtFahrenheit"].value);

or look at what Visual Studio .NET debugger tells you when you put
txtFahrenheit into the Watch window during a debug session.
2. lblCelsius.innertext does not work - it does not complain, but it
simply does not work.


It's always permissible to add an extra attribute on a client-side DOM
element.
Whether the browser interprets the attribute you've invented is another
matter.

Use

lblCelsius.innerText = "The result of the conversion is " +
event.result.value + " °Fahrenheit";

instead (note the camel case).
Derek Harmon

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: William Wisnieski | last post by:
Hello Everyone: I'm having a very strange problem occurring with my Access 2000 database. I call it the "mystery record." Here's the story: I have a query by form that returns a record set...
23
by: Ken Turkowski | last post by:
The construct (void*)(((long)ptr + 3) & ~3) worked well until now to enforce alignment of the pointer to long boundaries. However, now VC++ warns about it, undoubtedly to help things work on 64...
0
by: bleedledeep | last post by:
I have 3 C# applications that run as a group. If I run each of these applications individually, they all start fine. If I have a batch file that starts each of them quickly, on *most* machines...
6
by: GD | last post by:
Hi, I wonder how to disable the "submit" behavior of a button. What I want is to assign values to dynamically added user controls without page postback. Problem: dynamically created control can...
32
by: Axel Bock | last post by:
Hi all, I am trying to get my head around what happens if I return a class object from a function. It seems C++ (MinGW) does not invoke the copy constructor if I do something like this: ...
13
by: bobg.hahc | last post by:
running access 2k; And before anything else is said - "Yes, Virginia, I know you can NOT use a variable to set a constant (that's why it's constant)". BUT - my problem is - I want a constant,...
2
by: sukatoa | last post by:
I've invoke that .COM file using the code below, Runtime.getRuntime().exec("cmd /C start FINAL6.COM"); The program's behavior is wrong when i use this implementation.... When just double...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.