简体   繁体   English

删除网页上的部分文字

[英]Erasing a portion of the text on a webpage

So I'm working on a blackjack game and I have almost completed it except for the fact that if the user wants to play again, I do not have that as an option. 因此,我正在开发二十一点游戏,除了用户想要再次玩游戏,我几乎没有其他选择。 I was thinking of putting a windows.confirm dialog box and when "ok" is selected the previous blackjack game that he just played will be erased. 我当时想放置一个windows.confirm对话框,当选择“确定”时,他刚才玩的二十一点游戏将被删除。 I was wondering how I would go about erasing that previous game or if there is a better way of doing it. 我想知道如何删除以前的游戏,或者是否有更好的方法来删除它。

Thanks in advance! 提前致谢!

Give your element an Id, then hide it 给您的元素一个ID,然后将其隐藏

for example, 例如,

<img id="mypic" src="xx.jpg" />

document.getElementById('mypic').style.display = 'none';

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM