运行 ❯
获取您
自身
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>JavaScript String Methods</h1> <p>Search a string for "W3Schools", and display the position of the match:</p> <p id="demo"></p> <script> let text = "Visit W3Schools!"; let n = text.search("W3Schools"); document.getElementById("demo").innerHTML = n; </script> </body> </html>