如何将javascript代码转换为vb.net代码 [英] how to convert the javascript code to vb.net code

查看:99
本文介绍了如何将javascript代码转换为vb.net代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我必须用一个软件编写扫描码。但是在那个软件中它给出了javascript中的例子我希望vb.net中的代码

告诉我是否有任何工具可用

解决方案

 <   html   >  

< head >
< title > 线性同余< / title >

< script language = JavaScript >

函数Find_Solutions(f){
var a,b,m,d,显示

f.out.value =
display =
wait =
m = fmvalue - 0
a = favalue%m - 0
if(a < 0) { a = a + m }

b = fbvalue m - 0

if (b < 0) { b = b + m }

< span class =code-attribute>
d = < span class =code-keyword> gcd(a,m)



< span class =code-attribute> if (b d = 0) {

f.out.value = 无解决方案

return

}



< span class =code-attribute> for (x = 0; (a * x - b) m = 0; x ++) { < span class =code-attribute>

< span class =code-attribute> if (x 1000 = = 0) {

< span class =code-attribute> wait = 等待 +

f.out.value = 等待

}

}

display = display + x

(i
= 1; i < < span class =code-attribute> d; i ++) {

display = display + + (x + i *(m / d))

}



f.out 。值 = display

}



function gcd (a,b) {

< span class =code-attribute> var a,b

while (b < span class =code-attribute>! = 0) {

r = a b

a = b

b = r

< span class =code-attribute>}

return(Math.abs(a))

}



< / script >

< / head >

< body BGCOLOR = cornsilk >

< center >
< big > 线性同余< / big >
< p >

< 表格 >
形式的等式< B > ax < / B > = < B > b < / B > (mod < B < span class =code-keyword>> m < / B > )称为线性同余。< br >
输入< B > a < / B > < B > b < / B > < B > m < / B > ,此程序将找到所有解决方案。
< p >

< 输入 类型 = text < span class =code-attribute> size = 5 name = value = 2 maxlength = 5 > < font size = + 1 > x = < / font >
< 输入 类型 = text size = 5 名称 = b value = 4 maxlength = 5 > < font < span class =code-attribute> size = + 1 > (mod < / font >
< 输入 type = text size = 5 名称 = m value = 10 maxlength = 5 > < font size = + 1 > < ; / font >

< p >
< 输入 类型 = 按钮 = 查找解决方案 onClick = Find_Solutions(this.form) < span class =code-keyword>>
< p >
< table border = 0 > < tr >
< td valign = top > < B > x < / B > = < / td >
< td >
< textarea = 10 cols = 20 名称 = out wrap >
< / textarea >
< / td >
< / tr > < / table >
< / form >

< < span class =code-leadat致敬> / center >

< < span class =code-leadattribute> br > < br > < br > 返回加密< a href = syllabus.html > 教学大纲< ; / a > < br > < br >

< / body >

< / html >


这个问题毫无意义。语言的概念和目标完全不同;从一个到另一个没有任何明智的映射。您正在谈论的有效工具不存在。不是因为这很难做,而是因为它的功能没有任何意义。



也许你有一些特定的目标。如果你解释了它们是什么,你可能会得到一些有用的建议。



-SA


< blockquote>

 function fn_NSC_Total(){

var dtDOP = null ,fAmt,accIntrst = null ;
var fTotal = 0 ;

for var iCtr = 1 ; iCtr < = 10 ; iCtr ++){
dtDOP = document.getElementById( txtNwValDOP _ + iCtr)。 value ;
// alert(dtDOP);
fAmt = document.getElementById(< span class =code-string>
txtNwValAmtRs _ + iCtr)。 value ;
// alert(fAmt);
if (dtDOP!= ' '){
accIntrst = document.getElementById( txtNwValACC_Int _ + iCtr);
// alert(accIntrst);
// alert(fn_calcAccIntrest(dtDOP,fAmt));
accIntrst。 value = roundNumber(fn_calcAccIntrest(dtDOP,fAmt), 2 );
fTotal = parseFloat(fTotal)+ parseFloat(accIntrst。 value );
}
//alert(\"iCtrValue=\" + iCtr);
}
document.getElementById(\"txtNewValTotal\").value = roundNumber(fTotal, 2);
//alert(document.getElementById(\"txtTotalErlrValues\"));
var fErlrValues = document.getElementById(\"txtTotalErlrValues\");

if (fErlrValues != null)
document.getElementById(\"txtSubTotal\").value = Math.round(parseFloat(fTotal) + parseFloat(fErlrValues.value));
else
document.getElementById(\"txtSubTotal\").value = Math.round(parseFloat(fTotal));
return false ;

}


Hi,

i have to write the scanning code with one software. but in that software it had given the example in javascript i want that code in vb.net
Tell me if any tools are available

解决方案

<html>

<head>
<title>Linear Congruences</title>

<script language="JavaScript">

function Find_Solutions (f) {
    var a,b,m,d,display

    f.out.value = ""
    display = ""
    wait = ""
    m = f.m.value - 0
    a = f.a.value % m - 0
     if (a < 0) { a = a + m }

    b = f.b.value % m - 0

     if (b < 0) { b = b + m }

    d = gcd(a,m)



    if (b % d != 0) {

        f.out.value = "No solutions"

        return

    }



    for (x = 0; (a*x - b) % m != 0; x++) {

        if (x % 1000 == 0) {

            wait = wait + ". "

            f.out.value = wait

        }

    }

    display = display + x

    for (i = 1; i < d; i++) {

        display = display + ", " + (x + i*(m/d))

    }



    f.out.value = display

}



function gcd (a,b) {

    var a,b

    while (b != 0) {

        r = a % b

        a = b

        b = r

    }

    return(Math.abs(a))

}



</script>

</head>

<body BGCOLOR="cornsilk">

<center>
<big>Linear Congruences</big>
<p>

<form>
An equation of the form <B>ax</B> = <B>b</B> (mod <B>m</B>) is called a linear congruence.<br>
Enter values for <B>a</B>, <B>b</B>, and <B>m</B> below, and this program will find all the solutions.
<p>

<input type=text size=5 name="a" value="2" maxlength=5><font size=+1> x = </font>
<input type=text size=5 name="b" value="4" maxlength=5> <font size=+1>(mod</font>
<input type=text size=5 name="m" value="10" maxlength=5><font size=+1>)</font>

<p>
<input type=button value="Find Solutions" onClick="Find_Solutions(this.form)">
<p>
<table border=0><tr>
  <td valign=top><B>x</B> =</td>
  <td>
    <textarea rows=10 cols=20 name="out" wrap>
    </textarea>
  </td>
</tr></table>
</form>

</center>

<br><br><br>Back to the cryptology <a href="syllabus.html">syllabus</a>.<br><br>

</body>

</html>


The question makes no sense. The concepts and targets of the languages are totally different; there is no any sensible mapping from one to another. The valid tool you are talking about cannot exist. Not because this is difficult to make, but because its functionality would not make any sense.

Perhaps you have some particular goal in mind. If you explained us what it is, you would probably get some useful advice.

—SA


function fn_NSC_Total() {

            var dtDOP = null, fAmt, accIntrst = null;
            var fTotal = 0;

            for (var iCtr = 1; iCtr <= 10; iCtr++) {
                dtDOP = document.getElementById("txtNwValDOP_" + iCtr).value;
                //alert(dtDOP);
                fAmt = document.getElementById("txtNwValAmtRs_" + iCtr).value;
                //alert(fAmt);
                if (dtDOP != '') {
                    accIntrst = document.getElementById("txtNwValACC_Int_" + iCtr);
                    //alert(accIntrst);
                    //alert(fn_calcAccIntrest(dtDOP, fAmt));
                    accIntrst.value = roundNumber(fn_calcAccIntrest(dtDOP, fAmt), 2);
                    fTotal = parseFloat(fTotal) + parseFloat(accIntrst.value);
                }
                //alert("iCtrValue=" + iCtr);
            }
            document.getElementById("txtNewValTotal").value = roundNumber(fTotal, 2);
            //alert(document.getElementById("txtTotalErlrValues"));
            var fErlrValues = document.getElementById("txtTotalErlrValues");

            if (fErlrValues != null)
                document.getElementById("txtSubTotal").value = Math.round(parseFloat(fTotal) + parseFloat(fErlrValues.value));
            else
                document.getElementById("txtSubTotal").value = Math.round(parseFloat(fTotal));
            return false;

        }


这篇关于如何将javascript代码转换为vb.net代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆