[英]javascript create table on button click on another page
ok i need a big time help as i am very new to javascript. 好的,我需要大量时间帮助,因为我对javascript很陌生。 i have two HTML pages productquantity.html and checkout.html.
我有两个HTML页面productquantity.html和checkout.html。 now i want to create table with some data on button click from productquantity.html and diplay the table on checkout.html
现在我想在productquantity.html上单击按钮时创建一些带有数据的表,并在checkout.html上显示该表
javascript code: JavaScript代码:
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function doMath() {
int = "2000"
var one = eval(int)
var two = eval(document.theForm.elements[0].value)
var prod = one * two
document.getElementById("showsum").innerHTML = ( prod );
}
// End -->
</SCRIPT>
html code: html代码:
<FORM NAME="theForm" action="display.html" method="GET">
<INPUT TYPE="text">
<INPUT TYPE="button" VALUE="Show result" onClick="doMath()">
<div id="showsum"> </div>
</FORM>
at the moment its showing result on same page but i want to diplay result on another page in table when submit button is clicked 目前其显示结果在同一页上,但我想在单击提交按钮时在表的另一页上显示结果
If you want to load something from a file to another you should use ajax (I suggest using jQuery for this). 如果要将文件中的内容加载到另一个文件中,则应使用ajax(我建议为此使用jQuery)。
$('#result').load('productquantity.html ', function() {
alert('The other page is loaded');
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.