Javascript window.alert 更改为文本

标签 javascript html

我有一个简单的问题

如何更改

window.alert ('Please input data into the \"Part No.\" field.');

只是文本,没有警报

Please input data into the \"Part No.\" field.

最佳答案

这取决于您希望文本放置的位置:

var text = 'Please input data into the \'Part No.\' field.'

//inside a div
div.innerHTML = text;

//the bottom of the body
document.body.innerHTML+=text;

//an input field
input.value = text;

//rewriting the document
document.open();
document.write(text);
document.close();

关于Javascript window.alert 更改为文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16765153/

相关文章:

html - 带有两个全 Angular block 按钮的 Bootstrap 列

javascript - 未捕获的ReferenceError : load is not defined

javascript - 在内容可编辑的 div 中禁用特定的按键事件

javascript - 处理、镜像或翻转图像而不影响其他图像

javascript - 修改jQuery函数(抓取每个DOM元素)

javascript - 如何将像素添加到元素的当前位置?

css - 将文本居中并将 div float 到右侧

html - :before selector not taking full height 中的 css 边框样式

javascript - form.submit() 不包括发送提交按钮

javascript - 页面加载时隐藏菜单,onclick按钮显示菜单,第一次单击显示,第二次单击隐藏,就像 Angular 4.0中的切换一样