2 回答
TA贡献1871条经验 获得超13个赞
class Program
{
static void Main(string[] args)
{
string saveHtml = "<html>" +
"<head>" +
" <title>Select Image</title>" +
" <script type=\"text/javascript\">" +
" function displayImage(elem) {" +
" var image = document.getElementById(\"canvas\");" +
" image.src = elem.value; " +
" }" +
" </script>" +
"</head>" +
"<body>" +
" <form name=\"controls\">" +
" <img id=\"canvas\" src=\"pictures/fire1.jpg\" />" +
" <select name=\"imageList\" onchange=\"displayImage(this);\">" +
" <option value=\"pictures/001JRPchargeable.png\">Fire 1</option>" +
" <option value=\"pictures/001JRPNonchargeable.png\">Fire 2</option>" +
"</select>" +
" </form>" +
"</body>" +
"</html>";
File.WriteAllText(@"C:\temp\theFile.html", saveHtml);
}
}
TA贡献1802条经验 获得超5个赞
您可以使用此代码:
string saveHtml = "<html>" +
"<head>" +
" <title>Select Image</title>" +
" <script type=\"text/javascript\">" +
" function displayImage(elem) {" +
" var image = document.getElementById(\"canvas\");" +
" image.src = elem.value; " +
" }" +
" </script>" +
"</head>" +
"<body>" +
" <form name=\"controls\">" +
" <img id=\"canvas\" src=\"pictures/fire1.jpg\" />" +
" <select name=\"imageList\" onchange=\"displayImage(this);\">" +
" <option value=\"pictures/001JRPchargeable.png\">Fire 1</option>" +
" <option value=\"pictures/001JRPNonchargeable.png\">Fire 2</option>" +
"</select>" +
" </form>" +
"</body>" +
"</html>";
string path = @"D:\Test.html";
System.IO.File.WriteAllText(path, saveHtml)
- 2 回答
- 0 关注
- 144 浏览
添加回答
举报