我正在尝试使用javascript处理XML文件.
xhttp.open("GET","exportproject.xml",false);
Run Code Online (Sandbox Code Playgroud)
我想要做的是,让用户使用File uploader指定文件(而不是将其硬编码到exportproject.xml),然后使用javascript处理它而不是将其发送到服务器.
可能吗?
我试图POST动态表单元素使用javascript添加但无法这样做.我添加它们时会显示这些元素,但在test.php页面上看不到任何内容.
我一直试图找出问题,但徒劳无功.我还使用Firebug来检查DOM元素,但它看起来很好.请帮忙
这是我的代码:
<html>
<head>
<script type="text/javascript">
function add() {
//Create an input type dynamically.
var element1 = document.createElement("input");
var element2 = document.createElement("input");
var newdiv = document.createElement("button");
var space = document.createElement("div");
//Assign different attributes to the element.
element1.setAttribute("type", "text");
element2.setAttribute("type", "text");
//newdiv.setAttribute("type", "button");
//element.setAttribute("value", type);
//element.setAttribute("name", type);
var numi = document.getElementById('theValue');
var num = (document.getElementById('theValue').value -1)+ 2;
numi.value = num;
var area = document.getElementById('area');
var divIdName1 = 'name'+num;
var divIdName2 = 'amount'+num;
var divIdName3 = 'button'+num;
element1.setAttribute('id',divIdName1);
element2.setAttribute('id',divIdName2);
newdiv.setAttribute('id',divIdName3);
element1.setAttribute('value',divIdName1); …Run Code Online (Sandbox Code Playgroud) #include<stdio.h>
#include<math.h>
int main()
{
float i = 2.5;
printf("%d\n%d\n%d",i,i,i);
}
Run Code Online (Sandbox Code Playgroud)
当我使用gcc编译它并运行它时,我得到它作为输出:
0
1074003968
0
Run Code Online (Sandbox Code Playgroud)
为什么不打印
2
2
2
Run Code Online (Sandbox Code Playgroud)