mirror of
https://github.com/rn10950/RetroZilla.git
synced 2024-11-15 04:00:12 +01:00
122 lines
4.7 KiB
HTML
122 lines
4.7 KiB
HTML
|
<HTML>
|
||
|
<HEAD>
|
||
|
</HEAD>
|
||
|
<BODY>
|
||
|
<H1>SOAP Test: Elements</H1>
|
||
|
This page is linked to elements of the periodic table.
|
||
|
<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=soapelementsproxy.js>soapelementsproxy.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 not friendly to untrusted applets, it may not be
|
||
|
called without requesting additional privileges from the user. It can be
|
||
|
made friendly by accepting the verifySource header or by loading the page
|
||
|
and proxy from the domain of the service.
|
||
|
<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=soapelementsproxy.js></script>
|
||
|
<SCRIPT>
|
||
|
|
||
|
var elements = new Elements();
|
||
|
var currentnumber = "0";
|
||
|
var currentsymbol = "";
|
||
|
var add = false;
|
||
|
|
||
|
// Passed in as the response handler in the asynchronous case
|
||
|
// and called directly (see below) in the synchronous case
|
||
|
function receiveelement(e)
|
||
|
{
|
||
|
var info = document.getElementById('INFO');
|
||
|
if (!add) {
|
||
|
while (info != null) {
|
||
|
info.parentNode.removeChild(info);
|
||
|
info = document.getElementById('INFO');
|
||
|
}
|
||
|
}
|
||
|
if (e != null) {
|
||
|
currentnumber = e.atomicnumber;
|
||
|
document.getElementById('NUMBER').value = currentnumber;
|
||
|
currentsymbol = e.symbol;
|
||
|
document.getElementById('SYMBOL').value = currentsymbol;
|
||
|
info = document.createElement("P");
|
||
|
info.id = "INFO";
|
||
|
var emphasis;
|
||
|
emphasis = document.createElement("B");
|
||
|
info.appendChild(emphasis);
|
||
|
emphasis.appendChild(document.createTextNode(e.name));
|
||
|
info.appendChild(document.createTextNode(" was discovered in the year "));
|
||
|
emphasis = document.createElement("B");
|
||
|
info.appendChild(emphasis);
|
||
|
emphasis.appendChild(document.createTextNode(e.found));
|
||
|
info.appendChild(document.createTextNode(". Symbol: "));
|
||
|
emphasis = document.createElement("B");
|
||
|
info.appendChild(emphasis);
|
||
|
emphasis.appendChild(document.createTextNode(e.symbol));
|
||
|
info.appendChild(document.createTextNode(". Atomic Number: "));
|
||
|
emphasis = document.createElement("B");
|
||
|
info.appendChild(emphasis);
|
||
|
emphasis.appendChild(document.createTextNode(e.atomicnumber));
|
||
|
info.appendChild(document.createTextNode(". Mass: "));
|
||
|
emphasis = document.createElement("B");
|
||
|
info.appendChild(emphasis);
|
||
|
emphasis.appendChild(document.createTextNode(e.mass));
|
||
|
info.appendChild(document.createTextNode(". Melting Point: "));
|
||
|
emphasis = document.createElement("B");
|
||
|
info.appendChild(emphasis);
|
||
|
emphasis.appendChild(document.createTextNode(e.meltingPoint));
|
||
|
info.appendChild(document.createTextNode("K. Boiling Point: "));
|
||
|
emphasis = document.createElement("B");
|
||
|
info.appendChild(emphasis);
|
||
|
emphasis.appendChild(document.createTextNode(e.boilingPoint));
|
||
|
info.appendChild(document.createTextNode("K."));
|
||
|
document.getElementById('NUMBER').parentNode.appendChild(info);
|
||
|
}
|
||
|
else {
|
||
|
var number = document.getElementById('NUMBER').value;
|
||
|
var symbol = document.getElementById('SYMBOL').value;
|
||
|
// Perhaps another search will find it
|
||
|
if (number != currentnumber || symbol != currentsymbol) {
|
||
|
element(number,symbol, add);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function element(number, symbol, additem)
|
||
|
{
|
||
|
if (symbol != "" && symbol != currentsymbol) {
|
||
|
currentsymbol = symbol;
|
||
|
elements.getElementBySymbol(currentsymbol, receiveelement);
|
||
|
}
|
||
|
else if (number != "" && number != currentnumber) {
|
||
|
currentnumber = number;
|
||
|
elements.getElementByNumber(currentnumber, receiveelement);
|
||
|
}
|
||
|
else if (symbol != "") {
|
||
|
currentsymbol = symbol;
|
||
|
elements.getElementBySymbol(currentsymbol, receiveelement);
|
||
|
}
|
||
|
else if (number != "") {
|
||
|
currentnumber = number;
|
||
|
elements.getElementByNumber(currentnumber, receiveelement);
|
||
|
}
|
||
|
add = additem;
|
||
|
}
|
||
|
|
||
|
</SCRIPT>
|
||
|
<P>
|
||
|
<FORM>
|
||
|
|
||
|
Symbol: <INPUT label=Symbol ID=SYMBOL TYPE="text">
|
||
|
Atomic Number: <INPUT label=Number ID=NUMBER TYPE="text">
|
||
|
<INPUT TYPE="button" VALUE="New" ONCLICK="element(document.getElementById('NUMBER').value,document.getElementById('SYMBOL').value,false);">
|
||
|
<INPUT TYPE="button" VALUE="Add" ONCLICK="element(document.getElementById('NUMBER').value,document.getElementById('SYMBOL').value,true);">
|
||
|
<INPUT TYPE="button" VALUE="Next" ONCLICK="element(1 + (document.getElementById('NUMBER').value - 0), currentsymbol, true);">
|
||
|
</BODY>
|
||
|
</HTML>
|