如何在javascript结果中添加中断

时间:2015-05-28 04:12:00

标签: javascript

我想知道是否有人可以告诉我如何在我的.innerHTML中添加类似于休息的内容。

就像现在一样,它将答案列为:

添加两个数字4收回两个数字0乘以两个数字4划分两个数字1

所有单行,我想知道是否有办法将其分解,因此它看起来像列表项。

像这样:

  • 添加两个数字4
  • 减去两个数字0
  • 将两个数字相乘4
  • 除以两个数字1

显然没有任何要点。

这是我的代码:

提前致谢!



kernel void change_color(read_only image2d_t img, write_only image2d_t out) {
    int x = get_global_id(0);
    int y = get_global_id(1);

    int2 coords = {x, y};

    float4 v = {1, 1, 0, 1};

    write_imagef(out, coords, v);
}




2 个答案:

答案 0 :(得分:1)

只需将br标签放在那里,因为它是html

document.getElementById("MULTI").innerHTML = "Adding the two numbers" +result
            + "<br>Subtracting the two numbers " +result1 
            + "<br>Multiplying the two numbers " +result2 
            + "<br>Dividing the two numbers" +result3;

答案 1 :(得分:0)

.innerHTML在元素中写入HTML,因此请像在HTML中一样使用<br />

document.getElementById("MULTI").innerHTML = "Adding the two numbers" +result
        + "<br /> Subtracting the two numbers" +result1 
        + "<br /> Multiplying the two numbers" +result2 
        + "<br /> Dividing the two numbers" +result3;