本文介绍了多行打印的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码-它全部打印在一行中,但我希望它是多行的.请帮助
this is my code - it prints all in one line but i want it to be multiline. plz help
function display()
{
var divElements = document.getElementById("selection").innerHTML;
var oldPage = document.body.innerHTML;
document.body.innerHTML = "The Ninja Centre Order Receipt" +
document.getElementById("first").value +
document.getElementById("last").value +
document.getElementById("address").value +
document.getElementById("suburb").value +
document.getElementById("state").value +
document.getElementById("postcode").value +
document.getElementById("country").value +
document.getElementById("email").value +
document.getElementById("contact").value +
document.getElementById("selection").value +
document.getElementById("result").value
window.print();
document.body.innerHTML = oldPage;
}
推荐答案
您可能正在寻找这样的<br/>
标记:-
You are probably looking for <br/>
tag like this:-
function display()
{
var divElements = document.getElementById("selection").innerHTML;
var oldPage = document.body.innerHTML;
document.body.innerHTML = "The Ninja Centre Order Receipt" + '<br/>'+
document.getElementById("first").value + '<br/>'+
document.getElementById("last").value + '<br/>'+
document.getElementById("address").value + '<br/>' +
document.getElementById("suburb").value + '<br/>'+
document.getElementById("state").value + '<br/>'+
document.getElementById("postcode").value + '<br/>'+
document.getElementById("country").value + '<br/>'+
document.getElementById("email").value + <br/> +
document.getElementById("contact").value + '<br/>'+
document.getElementById("selection").value + '<br/>'+
document.getElementById("result").value
window.print();
document.body.innerHTML = oldPage;
}
这篇关于多行打印的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!