西门子网络服务器在 html 中使用 JavaScript 更改图像
我尝试使用 javascript 根据真/假条件动态更改 html 页面中的图片。 如果变量为 0,则应在 html 页面中显示另一张图片;如果为 1,则应显示另一张图片。
项目中有很多图片需要更改,我需要一个可以执行此应用程序的功能。但我不知道是否可以使用单个函数来完成,或者我应该为每个变量使用一个函数。
西门子网络服务器是否通过键入 :="X": 自动应用变量更改: 当 x 为 0 而不是 :="X" 时:数字 0 被替换;当 x 为 1 而不是 :="X" 时:数字 1 被替换。 我熟悉 html 编码以及如何使用图像名称并在图像名称后添加 0 或 1 来更改图片。 例如,我将一张图片命名为 stop0.png ,将另一张图片命名为 stop1.png 。现在在 html 代码中我输入 stop:="X":.png 这样图片会根据变量 x 变化 但这种方法需要刷新页面才能显示变化。我想以最简单的方式做到这一点,而无需刷新页面。
Im trying to dynamically change a picture in html page according to a true/false condition using javascript.
If the variable is 0 an image and if it was 1 another picture should be shown in html page.
There are many pictures in a project that need to be changed i need a function that can do this application. But i dont know if it can be done with a single function or i should use a function for each variable.
Is siemens webserver the variable change is applied automatically by typing :="X":
when x is 0 instead of :="X": the number 0 is replaced and for the 1 instead of :="X": the number 1 is replaced.
Im familiar with html coding and how to change the picture using the image name and adding 0 or 1 after image name.
For example i name a picture stop0.png and another picture stop1.png . now in the html code i type stop:="X":.png in this way picture changes according to variable x
But this method needs the page to be refreshed to show the change. I want to do this in the easiest way possible without page refresh.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
hmi 应该设计在一个页面中(例如名为 test.htm),另一个带有以下代码的 html 页面将每秒更新“test.htm”中的所有内容。
hmi should be designed in one page (for example named test.htm) and another html page with following code would update every thing in "test.htm" every second.