请在循环方面需要帮助. [英] Need help with Loops, please.

查看:67
本文介绍了请在循环方面需要帮助.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

FOR LOOPS(在函数内部)创建一个带有两个文本输入框的页面.用户必须在这些输入框中输入0到20之间的两个数字.在消息框中显示第一个和第二个数字之间的所有数字. (例如,如果用户输入3和8,则消息框应显示为"4 5 6 7").

我用这个Q尝试了很多事情,但是似乎无法得到答案.请帮忙吗?

FOR LOOPS(inside a function) Create a page with two text inputboxes. The user must enter two numbers between 0 and 20 into these inputboxes. Display all the numbers between the first and the second number in a messagebox. (Example, if the user enters 3 and 8, the messagebox should read "4 5 6 7").

I tried many things with this Q but simply cant seem to get an answer. Please help?

推荐答案

您可以通过研究一些 ^ ] .
You can learn how to solve this problem by studying some of these tutorials[^].


<input id="inp1" runat="server" />
<input id="inp2" runat="server" />





for(int i=(convert.toint32(inp1.text)+1);i<convert.toint32(inp2.text);i++)>
{
response.write(i);
}


<input id="inp1" runat="server" />
<input id="inp2"  runat="server" />
<input type="button" onclick="GetData();" />

function GetData(){
var txt1=document.GetelementById("inp1");
var txt2=document.GetelementById("inp2");

 
var Num1=parseInt(txt1.value);
var Num2=parseInt(txt2.value);
var x='';
 if(Num1>Num2)
 {
  for(int i=Num1;i<num2;i++)>
  {
    x=x+" "+i.Tostring();
  }
  if(x!='')
    alert(x);
 }
}


这篇关于请在循环方面需要帮助.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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