请输入您要查询的字词:

 

单词 JavaScript
释义

JavaScript


JavaScript (called JScript by Microsoft and ECMAScript by the WC3) is an interpreted scripting languagePlanetmathPlanetmath primarily used on the Internet to perform basic input validation and to implement basic Web calculators. Other than the fact that Netscape Corporation licensed the use of the word ”Java” from Sun, that JavaScript uses Java’s C++ (http://planetmath.org/C)-like syntax and that JavaScript is deployed on the Internet, there is nothing in common between Java and JavaScript. The major modern Web browsers implement JavaScript: Netscape’s Navigator, of course, and also Microsoft’s Internet Explorer, Mozilla’s Mozilla and FireFox, Opera, etc.

The following JavaScript program takes two integers as inputs and outputs their greatest common divisorMathworldPlanetmathPlanetmath using Euclid’s algorithmMathworldPlanetmath. This is intended for Microsoft Internet Explorer 4.0 or higher; the code is placed between script tags in the head element of the HTML page, the body element should have a form element with appropriately labelled inputs, a span of text where the script will write the results to, and a button that calls the calcGCD() function.

function calcGCD(a, b) {  wA = a;  wB = b;  while ( wB > 0 ) {    tempA = wA;    wA = wB    wB = tempA % wB;  }  return wA;}function goGCD() {  x = parseInt( document.forms[0].Xval.value );  y = parseInt( document.forms[0].Yval.value );  if ( isNaN( x ) || isNaN( y ) ) {    alert( "Please enter integers." );  } else {    document.all.GCDResultLine.innerText = "The greatest common divisor of " + x + " and " + y + " is " + calcGCD(x, y);  }}

References

  • 1 A. Danesh Javascript in 10 Simple Steps or Less Indianapolis: Wiley (2004)
  • 2 D. Flannagan JavaScript Pocket Reference New York: O’Reilly (1998)

.1 External links

http://bobspoetry.com/eVoteDemo.htmlElectronic Voting Demonstration Since this voting demo is implemented in JavaScript rather than Java, the source code may be inspected using the Web browser’s View Source command. This is not the case of Diebold voting machines.

http://www.btinternet.com/ se16/js/factor.htmHenry Bottomley’s Prime FactorsMathworldPlanetmathPlanetmath Calculator Uses trial divisionMathworldPlanetmath to factor input integers.

随便看

 

数学辞典收录了18232条数学词条,基本涵盖了常用数学知识及数学英语单词词组的翻译及用法,是数学学习的有利工具。

 

Copyright © 2000-2023 Newdu.com.com All Rights Reserved
更新时间:2025/5/24 18:37:14