开发者

Highlight text stored in cookie with javascript

开发者 https://www.devze.com 2023-03-30 17:35 出处:网络
Hi guys i ha开发者_如何学Pythonve to do these tasks with javascript. i have tried several ways but none of them worked.

Hi guys i ha开发者_如何学Pythonve to do these tasks with javascript. i have tried several ways but none of them worked.

  1. highlight selected text -done
  2. store highlighted text's start and end index in cookie so that if user comes again to this page in same session then it should be highlighted- done

  3. *now i have start and end index of the text in a cookie in the document i have to highlight that text* i have stored start and end index in two arrays from cookie.

if i store text in the cookie and on page load replace it with formatted text then i would replace first occurrence of the text which may be the text which is not the next whose start index and end index is sored in array.

i have to find some other way which takes start and end index for highligting the text

plz help


How about using Rangy's serializer module (demo)?

Disclosure: I am Rangy's author.

0

精彩评论

暂无评论...
验证码 换一张
取 消