搜索网站上的文字

编程入门 行业动态 更新时间:2024-10-25 02:22:19
本文介绍了搜索网站上的文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

尊敬的会员,

我在一个模板的帮助下设计纯HTML网站。

在这我有一个文本框[搜索]和开始按钮。

我想进行操作,以便当任何一个键入某些文本并按下Go按钮时,它应该突出显示该网站中与该文本匹配的文本。

我该怎么做?

解决方案

搜索网站意味着您需要从html代码中找到一个字符串。您可以在这种情况下使用JavaScript。

var position = document.documentElement.innerHTML.indexOf('text to search');

这会返回您的位置,您可以修改帽子字符串的css焦点。

Respected Members,

I am designing the website in pure HTML with the help of one Template.

In that i have one textbox[search] and Go button.

I want to make operation such that when any one types certain text and presses Go button, It should highlight the text in that website which is matching to that text.

How can i do that?

Than You.

解决方案

searching website means you need to find a string from html code. You can use javascript in this case.

var position = document.documentElement.innerHTML.indexOf('text to search');

This will return you the position, the you can modify the css for hat string to focus.

更多推荐

搜索网站上的文字

本文发布于:2023-11-28 19:31:59,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1643681.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:站上   搜索网   文字

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!