Highlight text stored in cookie with javascript
Hi guys i ha开发者_如何学Pythonve to do these tasks with javascript. i have tried several ways but none of them worked.
- highlight selected text -done
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
*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.
精彩评论