當前位置:係統粉 > 電腦問答 > 其他問答 > 好心人幫我為這段JAVA程序加下注釋

好心人幫我為這段JAVA程序加下注釋

提問者:roger仔仔  |  瀏覽 次  |  提問時間:2017-03-28  |  回答數量:9

好心人幫我為這段JAVA程序加下注釋<script type=\"text/javascript\"> window.resizeTo(500, 300); //控製窗口打開的大小 像這樣的....var showasciiformulaonhover = false; HTMLArea = window.opener.HTMLArea; function i18n(str) { return (HTMLArea._lc(str, &#39;Equation&#39;)); } function set (string) { var inputField = document.getElementById(\"inputText\"); inputField.value += string; preview(); inputField.focus(); return false; } function preview() { if (document.getElementById(\"inputText\") != &#39;&#39;) { var str = documen

已有9條答案
肌肉熊貓

肌肉熊貓

回答數:85  |  被采納數:37

2017-03-28 15:21:37
天書~~完全看不懂
讚 8
bbb2b2bb

bbb2b2bb

回答數:151  |  被采納數:71

2017-03-28 17:13:50
代碼沒貼完整
AMinitSymbols()
AMprocessNode()
2個都是自定義的方法而你的代碼中沒有2個方法的具體實現
讚 15
馬崗妹妹

馬崗妹妹

回答數:37  |  被采納數:15

2017-03-28 21:55:53





我隻是想給每句加點注釋就可以 知道每句大概所實現的功能.....先...謝謝您
讚 3
black丶lotus_0

black丶lotus_0

回答數:188  |  被采納數:67

2017-03-28 21:39:02
網頁上數學公式的完美輸入和顯示 靜態的HTML語言都能看懂 就是JSP的語言就不明白是什麼意思了 ..

index文件

<html><!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>AsciiMath Formula Input</title>
<script type="text/javascript" src="popup.js" tppabs="http://www.realtruth.org/Cfg/xinha/popups/popup.js"></script>
<script type="text/javascript" src="ASCIIMathML.js" tppabs="http://www.realtruth.org/Cfg/xinha/plugins/Equation/ASCIIMathML.js"></script>
<link rel="stylesheet" type="text/css" href="popup.css" tppabs="http://www.realtruth.org/Cfg/xinha/popups/popup.css" />

<style type="text/css">
#outputNode,#inputText {
padding:5px;
background-color:white;
width:230px;
height:200px;
font-size:1.3em;
border: 1px solid darkgrey;
}
#clickInput {
width:100%;
border-collapse:collapse;
background-color: white;
text-align:center;
}
#clickInput td {
border: thin solid gray;
cursor:pointer;
font-size:1.1em;

}
h3 {
font-size:1.6em;
}
</style>
<script type="text/javascript">
window.resizeTo(500, 300);
var showasciiformulaonhover = false;
HTMLArea = window.opener.HTMLArea;

function i18n(str) {
return (HTMLArea._lc(str, &#39;Equation&#39;));
}
function set (string)
{
var inputField = document.getElementById("inputText");
inputField.value += string;
preview();
inputField.focus();
return false;
}
function preview() {
if (document.getElementById("inputText") != &#39;&#39;) {
var str = document.getElementById("inputText").value;
var outnode = document.getElementById("outputNode");
var newnode = AMcreateElementXHTML("div");
newnode.setAttribute("id","outputNode");
outnode.parentNode.replaceChild(newnode,outnode);
outnode = document.getElementById("outputNode");
var n = outnode.childNodes.length;
for (var i = 0; i < n; i++)
outnode.removeChild(outnode.firstChild);
outnode.appendChild(document.createComment("`"+str+"`"));
AMprocessNode(outnode,true);
}
}
function Init() {
__dlg_translate(&#39;Equation&#39;);
__dlg_init();
var param = window.dialogArguments;
var cfg = param["editor"].config;

mathcolor = cfg.Equation.mathcolor;
mathfontfamily = cfg.Equation.mathfontfamily;

var inputField = document.getElementById("inputText");

if (param["editedNode"] && param["editedNode"].tagName.toLowerCase() == &#39;span&#39;)
{
var formula = param["editedNode"].getAttribute("title").replace(/^`*(.*?)`*$/m,"$1");;
inputField.value = formula;
preview();
}
else inputField.value = &#39;&#39;;
inputField.focus();
}

function onOK() {

var param = {
"editedNode":window.dialogArguments.editedNode,
"formula" : document.getElementById("inputText").value
};

__dlg_close(param);
return false;
}

function onCancel() {
__dlg_close(null);
return false;
}

function translate() {
if (!AMtranslated) { // run this only once
AMtranslated = true;
AMinitSymbols();
AMprocessNode(document.getElementById("clickInput"),true);
preview();
}
}
window.onload = Init;
</script>

</head>

<body class="dialog">
<div class="title">AsciiMath Formula Input</div>
<!--
Table modified from CharacterMap for ASCIIMathML by Peter Jipsen
HTMLSource based on HTMLArea XTD 1.5 (http://mosforge/projects/htmlarea3xtd/) modified by Holger Hees
Original Author - Bernhard Pfeifer novocaine@gmx
-->
<tableid="clickInput">
<tr>
<td colspan="3" class="character" title="(x+1)/(x-1)" onclick="set(&#39;(x+1)/(x-1)&#39;)">`(x+1)/(x-1)`</td>
<td colspan="2" class="character" title="x^(m+n)" onclick="set(&#39;x^(m+n)&#39;)">`x^(m+n)`</td>
<td colspan="2" class="character" title="x_(mn)" onclick="set(&#39;x_(mn)&#39;)">`x_(mn)`</td>
<td colspan="2" class="character" title="sqrt(x)" onclick="set(&#39;sqrt(x)&#39;)">`sqrt(x)`</td>
<td colspan="3" class="character" title="root(n)(x)" onclick="set(&#39;root(n)(x)&#39;)">`root(n)(x)`</td>
<td colspan="2" class="character" title=""text"" onclick="set(&#39;"text"&#39;)">`"text"`</td>
<td colspan="2" class="character" ></td>
</tr><tr>
<td colspan="2" class="character" title="dy/dx" onclick="set(&#39;dy/dx&#39;)">`dy/dx`</td>
<td colspan="3" class="character" title="lim_(x->oo)" onclick="set(&#39;lim_(x->oo)&#39;)">`lim_(x->oo)`</td>
<td colspan="3" class="character" title="sum_(n=1)^oo" onclick="set(&#39;sum_(n=1)^oo&#39;)">`sum_(n=1)^oo`</td>
<td colspan="3" class="character" title="int_a^bf(x)dx" onclick="set(&#39;int_a^bf(x)dx&#39;)">`int_a^bf(x)dx`</td>
<td colspan="3" class="character" title="[[a,b],[c,d]]" onclick="set(&#39;[[a,b],[c,d]]&#39;)">`[[a,b],[c,d]]`</td>
<td colspan="2" class="character" title="((n),(k))" onclick="set(&#39;((n),(k))&#39;)">`((n),(k))`</td>
</tr><tr>
<td class="character" title="*" onclick="set(&#39;*&#39;)">`*`</td>
<td class="character" title="**" onclick="set(&#39;**&#39;)">`**`</td>
<td class="character" title="//" onclick="set(&#39;//&#39;)">`//`</td>
<td class="character" title="\\" onclick="set(&#39;\\\\&#39;)">`\\`</td>
<td class="character" title="xx" onclick="set(&#39;xx&#39;)">`xx`</td>
<td class="character" title="-:" onclick="set(&#39;-:&#39;)">`-:`</td>
<td class="character" title="@" onclick="set(&#39;@&#39;)">`@`</td>
<td class="character" title="o+" onclick="set(&#39;o+&#39;)">`o+`</td>
<td class="character" title="ox" onclick="set(&#39;ox&#39;)">`ox`</td>
<td class="character" title="o." onclick="set(&#39;o.&#39;)">`o.`</td>
<td class="character" title="sum" onclick="set(&#39;sum&#39;)">`sum`</td>
<td class="character" title="prod" onclick="set(&#39;prod&#39;)">`prod`</td>
<td class="character" title="^^" onclick="set(&#39;^^&#39;)">`^^`</td>
<td class="character" title="^^^" onclick="set(&#39;^^^&#39;)"><font size="+1">`&and;`</font></td>
<td class="character" title="vv" onclick="set(&#39;vv&#39;)">`vv`</td>
<td class="character" title="vvv" onclick="set(&#39;vvv&#39;)"><font size="+1">`&or;`</font></td>
</tr><tr>
<td class="character" title="!=" onclick="set(&#39;!=&#39;)">`!=`</td>
<td class="character" title="<=" onclick="set(&#39;<=&#39;)">`<=`</td>
<td class="character" title=">=" onclick="set(&#39;>=&#39;)">`>=`</td>
<td class="character" title="-<" onclick="set(&#39;-<&#39;)">`-<`</td>
<td class="character" title=">-" onclick="set(&#39;>-&#39;)">`>-`</td>
<td class="character" title="in" onclick="set(&#39;in&#39;)">`in`</td>
<td class="character" title="!in" onclick="set(&#39;!in&#39;)">`!in`</td>
<td class="character" title="sub" onclick="set(&#39;sub&#39;)">`sub`</td>
<td class="character" title="sup" onclick="set(&#39;sup&#39;)">`sup`</td>
<td class="character" title="sube" onclick="set(&#39;sube&#39;)">`sube`</td>
<td class="character" title="supe" onclick="set(&#39;supe&#39;)">`supe`</td>
<td class="character" title="O/" onclick="set(&#39;O/&#39;)">`O/`</td>
<td class="character" title="nn" onclick="set(&#39;nn&#39;)">`nn`</td>
<td class="character" title="nnn" onclick="set(&#39;nnn&#39;)"><font size="+1">`&cap;`</font></td>
<td class="character" title="uu" onclick="set(&#39;uu&#39;)">`uu`</td>
<td class="character" title="uuu" onclick="set(&#39;uuu&#39;)"><font size="+1">`&cup;`</font></td>
</tr><tr>
<td class="character" title="and" onclick="set(&#39;and&#39;)">`and`</td>
<td class="character" title="or" onclick="set(&#39;or&#39;)">`or`</td>
<td class="character" title="not" onclick="set(&#39;not&#39;)">`not`</td>
<td class="character" title="=>" onclick="set(&#39;==>&#39;)">`=>`</td>
<td class="character" title="if" onclick="set(&#39;if&#39;)">`if`</td>
<td class="character" title="<=>" onclick="set(&#39;<=>&#39;)">`<=>`</td>
<td class="character" title="AA" onclick="set(&#39;AA&#39;)">`AA`</td>
<td class="character" title="EE" onclick="set(&#39;EE&#39;)">`EE`</td>
<td class="character" title="_|_" onclick="set(&#39;_|_&#39;)">`_|_`</td>
<td class="character" title="TT" onclick="set(&#39;TT&#39;)">`TT`</td>
<td class="character" title="|--" onclick="set(&#39;|--&#39;)">`|--`</td>
<td class="character" title="|==" onclick="set(&#39;|==&#39;)">`|==`</td>
<td class="character" title="-=" onclick="set(&#39;-=&#39;)">`-=`</td>
<td class="character" title="~=" onclick="set(&#39;~=&#39;)">`~=`</td>
<td class="character" title="~~" onclick="set(&#39;~~&#39;)">`~~`</td>
<td class="character" title="prop" onclick="set(&#39;prop&#39;)">`prop`</td>
</tr><tr>
<td class="character" title="int" onclick="set(&#39;int&#39;)">`int`</td>
<td class="character" title="oint" onclick="set(&#39;oint&#39;)">`oint`</td>
<td class="character" title="del" onclick="set(&#39;del&#39;)">`del`</td>
<td class="character" title="grad" onclick="set(&#39;grad&#39;)">`grad`</td>
<td class="character" title="+-" onclick="set(&#39;+-&#39;)">`+-`</td>
<td class="character" title="oo" onclick="set(&#39;oo&#39;)">`oo`</td>
<td class="character" title="aleph" onclick="set(&#39;aleph&#39;)">`aleph`</td>
<td class="character" title="quad" onclick="set(&#39;quad&#39;)">`quad`</td>
<td class="character" title="diamond" onclick="set(&#39;diamond&#39;)">`diamond`</td>
<td class="character" title="square" onclick="set(&#39;square&#39;)">`square`</td>
<td class="character" title="|__" onclick="set(&#39;|__&#39;)">`|__`</td>
<td class="character" title="__|" onclick="set(&#39;__|&#39;)">`__|`</td>
<td class="character" title="|~" onclick="set(&#39;|~&#39;)">`|~`</td>
<td class="character" title="~|" onclick="set(&#39;~|&#39;)">`~|`</td>
<td class="character" title="<x>" onclick="set(&#39;<x>&#39;)">`<x>`</td>
<td class="character" title="/_" onclick="set(&#39;/_&#39;)">`/_`</td>
</tr><tr>
<td class="character" title="uarr" onclick="set(&#39;uarr&#39;)">`uarr`</td>
<td class="character" title="darr" onclick="set(&#39;darr&#39;)">`darr`</td>
<td class="character" title="larr" onclick="set(&#39;larr&#39;)">`larr`</td>
<td class="character" title="->" onclick="set(&#39;->&#39;)">`->`</td>
<td class="character" title="|->" onclick="set(&#39;|->&#39;)">`|->`</td>
<td class="character" title="harr" onclick="set(&#39;harr&#39;)">`harr`</td>
<td class="character" title="lArr" onclick="set(&#39;lArr&#39;)">`lArr`</td>
<td class="character" title="rArr" onclick="set(&#39;rArr&#39;)">`rArr`</td>
<td class="character" title="hArr" onclick="set(&#39;hArr&#39;)">`hArr`</td>
<td class="character" title="hata" onclick="set(&#39;hat&#39;)">`hata`</td>
<td class="character" title="ula" onclick="set(&#39;ul&#39;)">`ula`</td>
<td class="character" title="dota" onclick="set(&#39;dot&#39;)">`dota`</td>
<td class="character" title="ddota" onclick="set(&#39;ddot&#39;)">`ddota`</td>
<td class="character" title="veca" onclick="set(&#39;vec&#39;)">`veca`</td>
<td class="character" title="bara" onclick="set(&#39;bar&#39;)">`bara`</td>
<td class="character" title=":." onclick="set(&#39;:.&#39;)">`:.`</td>
</tr><tr>
<td class="character" title="NN" onclick="set(&#39;NN&#39;)">`NN`</td>
<td class="character" title="ZZ" onclick="set(&#39;ZZ&#39;)">`ZZ`</td>
<td class="character" title="QQ" onclick="set(&#39;QQ&#39;)">`QQ`</td>
<td class="character" title="RR" onclick="set(&#39;RR&#39;)">`RR`</td>
<td class="character" title="CC" onclick="set(&#39;CC&#39;)">`CC`</td>
<td class="character" title="bba" onclick="set(&#39;bb&#39;)">`bba`</td>
<td class="character" title="bbba" onclick="set(&#39;bbb&#39;)">`bbba`</td>
<td class="character" title="cca" onclick="set(&#39;cc&#39;)">`cca`</td>
<td class="character" title="fra" onclick="set(&#39;fr&#39;)">`fra`</td>
<td class="character" title="sfa" onclick="set(&#39;sf&#39;)">`sfa`</td>
<td class="character" title="tta" onclick="set(&#39;tt&#39;)">`tta`</td>
<td colspan="4" class="character" title="stackrel(->)(+)" onclick="set(&#39;stackrel(->)(+)&#39;)">`stackrel(->)(+)`</td>
<td class="character" title="upsilon" onclick="set(&#39;upsilon&#39;)">`upsilon`</td>
</tr><tr>
<td class="character" title="alpha" onclick="set(&#39;alpha&#39;)">`alpha`</td>
<td class="character" title="beta" onclick="set(&#39;beta&#39;)">`beta`</td>
<td class="character" title="gamma" onclick="set(&#39;gamma&#39;)">`gamma`</td>
<td class="character" title="Gamma" onclick="set(&#39;Gamma&#39;)">`Gamma`</td>
<td class="character" title="delta" onclick="set(&#39;delta&#39;)">`delta`</td>
<td class="character" title="Delta" onclick="set(&#39;Delta&#39;)">`Delta`</td>
<td class="character" title="epsi" onclick="set(&#39;epsi&#39;)">`epsi`</td>
<td class="character" title="zeta" onclick="set(&#39;zeta&#39;)">`zeta`</td>
<td class="character" title="eta" onclick="set(&#39;eta&#39;)">`eta`</td>
<td class="character" title="theta" onclick="set(&#39;theta&#39;)">`theta`</td>
<td class="character" title="Theta" onclick="set(&#39;Theta&#39;)">`Theta`</td>
<td class="character" title="iota" onclick="set(&#39;iota&#39;)">`iota`</td>
<td class="character" title="kappa" onclick="set(&#39;kappa&#39;)">`kappa`</td>
<td class="character" title="lambda" onclick="set(&#39;lambda&#39;)">`lambda`</td>
<td class="character" title="Lambda" onclick="set(&#39;Lambda&#39;)">`Lambda`</td>
<td class="character" title="mu" onclick="set(&#39;mu&#39;)">`mu`</td>
</tr><tr>
<td class="character" title="nu" onclick="set(&#39;nu&#39;)">`nu`</td>
<td class="character" title="pi" onclick="set(&#39;pi&#39;)">`pi`</td>
<td class="character" title="Pi" onclick="set(&#39;Pi&#39;)">`Pi`</td>
<td class="character" title="rho" onclick="set(&#39;rho&#39;)">`rho`</td>
<td class="character" title="sigma" onclick="set(&#39;sigma&#39;)">`sigma`</td>
<td class="character" title="Sigma" onclick="set(&#39;Sigma&#39;)">`Sigma`</td>
<td class="character" title="tau" onclick="set(&#39;tau&#39;)">`tau`</td>
<td class="character" title="xi" onclick="set(&#39;xi&#39;)">`xi`</td>
<td class="character" title="Xi" onclick="set(&#39;Xi&#39;)">`Xi`</td>
<td class="character" title="phi" onclick="set(&#39;phi&#39;)">`phi`</td>
<td class="character" title="Phi" onclick="set(&#39;Phi&#39;)">`Phi`</td>
<td class="character" title="chi" onclick="set(&#39;chi&#39;)">`chi`</td>
<td class="character" title="psi" onclick="set(&#39;psi&#39;)">`psi`</td>
<td class="character" title="Psi" onclick="set(&#39;Psi&#39;)">`Psi`</td>
<td class="character" title="omega" onclick="set(&#39;omega&#39;)">`omega`</td>
<td class="character" title="Omega" onclick="set(&#39;Omega&#39;)">`Omega`</td>
</tr>
</table>
<form action="javascript:void(0);">
<table >
<tr>
<td>Input</td><td>Preview</td>
</tr>
<tr>
<td>
<textarea id="inputText" onkeyup="preview()"></textarea>
</td>
<td>
<div id="outputNode"></div>
</td>
</tr>
<tr><td colspan="2">
<span>Based on ASCIIMathML by </span><a href="javascript:if(confirm(&#39;http://www.chapman.edu/~jipsen\n\n文件並未依 Teleport Pro 取回,因為 它的域或路徑超過開始網址中設置的範圍。\n\n你要從服務器上打開它嗎?&#39;))window.location=&#39;http://www.chapman.edu/~jipsen&#39;" tppabs="http://www.chapman.edu/~jipsen" target="new">Peter Jipsen</a>,
<a href="javascript:if(confirm(&#39;http://www.chapman.edu/\n\n文件並未依 Teleport Pro 取回,因為 它的域或路徑超過開始網址中設置的範圍。\n\n你要從服務器上打開它嗎?&#39;))window.location=&#39;http://www.chapman.edu/&#39;" tppabs="http://www.chapman.edu/" target="new">Chapman University</a><br />
<span>For more information on AsciiMathML visit this page: </span><a href="javascript:if(confirm(&#39;http://www1.chapman.edu/~jipsen/mathml/asciimath.html\n\n文件並未依 Teleport Pro 取回,因為 它的域或路徑超過開始網址中設置的範圍。\n\n你要從服務器上打開它嗎?&#39;))window.location=&#39;http://www1.chapman.edu/~jipsen/mathml/asciimath.html&#39;" tppabs="http://www1.chapman.edu/~jipsen/mathml/asciimath.html" onclick="window.open(this.href,&#39;_blank&#39;,&#39;&#39;);return false;">http://www1.chapman.edu/~jipsen/mathml/asciimath.html</a></td></tr>
</table>

<div id="buttons">
<span >Attention: Editing the formula in the editor is not possible, please use this dialog!</span>
<button type="submit" name="ok" onclick="return onOK();">OK</button>
<button type="button" name="cancel" onclick="return onCancel();">Cancel</button>
</div>
</form>
</body>
</html>
讚 18
霓琴兒

霓琴兒

回答數:186  |  被采納數:16

2017-03-28 16:54:17
是這樣的吧?
(1)


看了下源代碼
感覺最主要的是 這個function 給你注釋了

function preview() {
if (document.getElementById("inputText") != &#39;&#39;) {// 判斷表單頁麵id值為inputText 是否為空
var str = document.getElementById("inputText").value; // 如果不為空 把裏麵的值賦給var類型的 str變量
var outnode = document.getElementById("outputNode");// 得到表單頁麵id值是outputNode的value 並賦值給var類型的 outnode變量
var newnode = AMcreateElementXHTML("div"); // 通過AMcreateElementXHTML方法(作者自定義的)也是賦值
newnode.setAttribute("id","outputNode");//用setAttribute方法 把值outputNode 賦值給 newnode(應該是個集合)對象的 id屬性
outnode.parentNode.replaceChild(newnode,outnode);// 這一句是替換外部連接文件 為了兼容各種瀏覽器
outnode = document.getElementById("outputNode"); // 也是和上麵一樣 賦值語句
var n = outnode.childNodes.length; // 得到var outnode 子節點的長度
for (var i = 0; i < n; i++)// 用得到的長度n 做循環
outnode.removeChild(outnode.firstChild); //把outnode的第一個子節點刪除
outnode.appendChild(document.createComment("`"+str+"`"));// 把outnode中n個元素 連接起來
AMprocessNode(outnode,true); // 調用AMprocessNode方法(作者自定義的) 把outnode作為參數傳過去
}
}
讚 18
雪銀狐_x

雪銀狐_x

回答數:136  |  被采納數:14

2017-03-29 04:37:20

嗯 效果就是這樣的 我需要給主頁中的JSP調用代碼注釋一下就可以了

就是一樓的那段 勞煩您費心幫我寫下注釋 我實在是沒辦法 您注釋的那關鍵部分 我會好好的揣摩 再次對您的勞動表示謝意
讚 13
ok差一點成熟

ok差一點成熟

回答數:99  |  被采納數:32

2017-03-28 21:30:33
代碼太長了
有空再幫你看看吧要出門了
讚 9
qq77425703

qq77425703

回答數:45  |  被采納數:33

2017-03-28 17:06:26

非常感謝 我研究您注釋的關鍵部分呢

上麵的您大概給瞅瞅就行 3Q3Q :-) 我想加您QQ請教您 能發給我嘛?
讚 4
sheldon980423

sheldon980423

回答數:113  |  被采納數:20

2017-03-29 14:31:50
好的明天我幫你注釋一下 今天可能沒時間了
讚 11
解決方法
版權信息

Copyright @ 2011 係統粉 版權聲明 最新發布內容 網站導航