document.write(j+"+"+i+"="+m);中的+号是什么意思啊.n=parseFloat(prompt("请输入从1到n求和的n:","0"));为什么后面还要"0"这个啊.有什么用?为什么有些直接是""

来源:学生作业帮助网 编辑:作业帮 时间:2024/04/28 13:12:50

document.write(j+"+"+i+"="+m);中的+号是什么意思啊.n=parseFloat(prompt("请输入从1到n求和的n:","0"));为什么后面还要"0"这个啊.有什么用?为什么有些直接是""
document.write(j+"+"+i+"="+m);中的+号是什么意思啊.
n=parseFloat(prompt("请输入从1到n求和的n:","0"));为什么后面还要"0"这个啊.有什么用?为什么有些直接是""

document.write(j+"+"+i+"="+m);中的+号是什么意思啊.n=parseFloat(prompt("请输入从1到n求和的n:","0"));为什么后面还要"0"这个啊.有什么用?为什么有些直接是""
连接字符串用的
占位符 占位置用的 要不你输出的数据往哪里放啊?

n=parseFloat(prompt("请输入从1到n求和的n:","0"));为什么后面还要"0"这个啊。有什么用??为什么有些直接是""
原因:promot()方法有两个参数,第一个参数为 提示字符,在输入框上显示。 第二个参数为 默认值,在输入框内显示,
也就是说假如你什么也不输入却点击了确定,n的值将会是默认值0, 在接下来调用n的时候不会因为n的值为空的问...

全部展开

n=parseFloat(prompt("请输入从1到n求和的n:","0"));为什么后面还要"0"这个啊。有什么用??为什么有些直接是""
原因:promot()方法有两个参数,第一个参数为 提示字符,在输入框上显示。 第二个参数为 默认值,在输入框内显示,
也就是说假如你什么也不输入却点击了确定,n的值将会是默认值0, 在接下来调用n的时候不会因为n的值为空的问题而出现运算错误。
在JavaScript中 因为用var定义的变量是弱类型的,不会像其他编程语言一样类型不符时会出现错误。所以在promot方法下无论你输入什么都会赋值给n,如果n不为Number类型时,接下来的相加算法便得不到你预期的效果,只会得到NaN非数值的结果。
至于前面所说的+号,应该就是为了输出“j+i=m”这个字符串吧(当然j和i还有m并不是字符,而是其对应的数值)总而言之其作用是用来连接字符串的
建议楼主好好打下基础……

收起

麻烦告诉我这段话是做什么用的?document.write('');document.write('');document.write('');document.write('');document.write(''); document.write(x + ); document.write(y + ); document.write(z + ); document.write()是什么意思? document.write是什么语言?为什么这样使用.document.write内容 document.write(g_downUrl); 什么意思 document.write函数的用法? write里面的意思是什么.document.write(); document.write('.submenu{display:none;} ')是什么意思 以下题目中的(a=+a+i );是什么意思?下面程序段的运行结果为________. var i,j,a=0; for(i=0;i=0;j--) a++; document.write(a=+a+i ); JavaScript里的document.open();和document.close();到底什么作用,document.write();前后加不加这两句结果都一样啊.是不是说document.write()前的document.open()可以不写?另外document.close()不写会有什么后果,我感觉 document asp中 document.write“”是什么意思高手来解释一下 document.write(j+++i+=+m);中的+号是什么意思啊.n=parseFloat(prompt(请输入从1到n求和的n:,0));为什么后面还要0这个啊.有什么用?为什么有些直接是 JS中document.write(num + JS中document.write(num + num +“ ”中“”是什么东西?“”是空格的意思吗? document.write(); 的含义……在javasript中document的含意是?(文档)write的含意是?(写) document.write和response.write有什么区别啊?我把其中document.write改为response.write怎么就不显示拉呢. open the document and write some words ( ) it write some words ( ) it document.write('');在动态页里没问题,发现是在document.write里的onclick语法的问题,实在搞不懂了,只有这么多分了