开发者

javascript for saving the message automatically

I have a asp htmleditor where the user will enter any text or a message...is there any javascript to sav开发者_运维问答e the message every 5 seconds as drafts in vb.net .


As your question is not much clear, I am assuming that you want to save the text in the database and let's say the htmleditor is some simple text area. So, you need to do two things to save the texts of the htmleditor as draft.

  1. Do a ajax call which will do the saving part.
  2. Use javascript function setInterval() for doing ajax call repeatedly for some given (in your case 5 sec) time interval.

So let's say saveHtmlEditorText() is the function which does an ajax call to save the text. And now you have to initialize the setInterval(), you can use the document.ready() to initialize.

setInterval("saveHtmlEditorText()",5000);

You can see more about setInterval() here.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜