【发布时间】:2017-09-08 11:09:48
【问题描述】:
如何将占位符的颜色更改为白色?我知道我必须使用 -moz-placeholder 但我不知道如何将其格式化为 JAVASCRIPT。我需要以javascript格式匹配我下面的代码。
//User Name Input
var inputUserName = document.createElement("input");
inputUserName.type = "text";
inputUserName.style.bottom = "220px";
inputUserName.style.width = "170px";
inputUserName.style.height = "20px";
inputUserName.style.left = "50px";
inputUserName.style.textAlign = "center";
inputUserName.style.display = "none";
inputUserName.style.backgroundColor = "transparent";
inputUserName.style.borderBottom = "2px solid black";
inputUserName.style.borderTop = "transparent";
inputUserName.style.borderLeft = "transparent";
inputUserName.style.borderRight = "transparent";
inputUserName.placeholder = "User Name";
inputUserName.style.color = "white";
inputUserName.style.position = "absolute";
inputUserName.className = "UserNameSignUp";
inputUserName.UserNameSignUp = "-moz-placeholder";
//input.className = "css-class-name"; // set the CSS class
formArea.appendChild(inputUserName); // put it into the DOM
【问题讨论】: