系统粉 > 电脑问答 > 其他问答

已解决好心人帮我为这段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

代码没贴完整
AMinitSymbols()
AMprocessNode()
2个都是自定义的方法而你的代码中没有2个方法的具体实现
2017-03-28 17:13:50
赞 15
马岗妹妹

马岗妹妹

回答数:37  |  被采纳数:15






我只是想给每句加点注释就可以 知道每句大概所实现的功能.....先...谢谢您
2017-03-28 21:55:53
赞 3
black丶lotus_0

black丶lotus_0

回答数:188  |  被采纳数:67

网页上数学公式的完美输入和显示 静态的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>
2017-03-28 21:39:02
赞 18
霓琴儿

霓琴儿

回答数:186  |  被采纳数:16

是这样的吧?
(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作为参数传过去
}
}
2017-03-28 16:54:17
赞 18
雪银狐_x

雪银狐_x

回答数:136  |  被采纳数:14


嗯 效果就是这样的 我需要给主页中的JSP调用代码注释一下就可以了

就是一楼的那段 劳烦您费心帮我写下注释 我实在是没办法 您注释的那关键部分 我会好好的揣摩 再次对您的劳动表示谢意
2017-03-29 04:37:20
赞 13
ok差一点成熟

ok差一点成熟

回答数:99  |  被采纳数:32

代码太长了
有空再帮你看看吧要出门了
2017-03-28 21:30:33
赞 9
qq77425703

qq77425703

回答数:45  |  被采纳数:33


非常感谢 我研究您注释的关键部分呢

上面的您大概给瞅瞅就行 3Q3Q :-) 我想加您QQ请教您 能发给我嘛?
2017-03-28 17:06:26
赞 4
sheldon980423

sheldon980423

回答数:113  |  被采纳数:20

好的明天我帮你注释一下 今天可能没时间了
2017-03-29 14:31:50
赞 11
相关问答
最新其他问答
解决方法