mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-06 17:16:12 +00:00
817b1d3d66
None of these are part of any build.
60 lines
1.9 KiB
HTML
60 lines
1.9 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
</HEAD>
|
|
<BODY>
|
|
<H1>SOAP Test: Is It a Prime Number</H1>
|
|
The number typed in the text field will change color depending upon whether
|
|
the soap call reports <font color="green">prime</font> or
|
|
<font color="red">nonprime</font>.
|
|
<p>This works by calling a SOAP service.. View the source of
|
|
this page for details on how it was called. If you compile mozilla DEBUG, the
|
|
message sent and received will be logged to the console This loads js files
|
|
<a href=soapisprimeproxy.js>soapisprimeproxy.js</a> which relies on
|
|
<a href=soapproxy.js>soapproxy.js</a>, which implement a SOAP proxy on top
|
|
of the low level SOAP API in Mozilla. In a future version of Mozilla, it
|
|
should be possible to construct SOAP proxies directly from the wsdl file.
|
|
<p>Since this service is friendly to untrusted applets, it may be
|
|
called without requesting additional privileges from the user.
|
|
<p>Other services are available on the
|
|
<A href="http://www.xmethods.com">X Methods Website</A>.
|
|
Experimenters may wish to create other tests which exercize services, with
|
|
specific user interfaces.
|
|
<script src=soapproxy.js></script>
|
|
<script src=soapisprimeproxy.js></script>
|
|
<SCRIPT>
|
|
|
|
var primes = new IsPrime();
|
|
var currentValue;
|
|
|
|
// Passed in as the response handler in the asynchronous case
|
|
// and called directly (see below) in the synchronous case
|
|
function receiveisprime(isPrime) {
|
|
if (isPrime != null) {
|
|
if (isPrime) {
|
|
document.getElementById("NUMBER").style.color="green";
|
|
} else {
|
|
document.getElementById("NUMBER").style.color="red";
|
|
}
|
|
}
|
|
}
|
|
|
|
function isprime(value) {
|
|
if (value == "")
|
|
return;
|
|
if (value == currentValue)
|
|
return;
|
|
|
|
currentValue = value;
|
|
document.getElementById("NUMBER").style.color="black";
|
|
primes.isPrime(value, receiveisprime);
|
|
}
|
|
|
|
</SCRIPT>
|
|
<P>
|
|
<FORM>
|
|
<INPUT ID=NUMBER TYPE="text"
|
|
ONKEYUP="isprime(document.getElementById('NUMBER').value);">
|
|
</FORM>
|
|
</BODY>
|
|
</HTML>
|