Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use jQuery to publish Weibo program

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly explains "how to use jQuery to achieve the release of Weibo programs", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "how to use jQuery to publish Weibo programs"!

XHTML code

140 tell me what you are doing.

Content published by Demo.

XHTML is a form with an input box textarea, a publish button, a span#counter that counts the number of words entered, and an information prompt span#msg. If you submit without input, you will be prompted for input.

CSS code

H4 {height:32px; line-height:32px; font-size:18px} h4 span {float:right; font-size:32px; font-family:Georgia,serif; color:#ccc; overflow:hidden} .input {width:594px; height:58px; margin:5px 0 10px 0; padding:4px 2px; border:1px solid # aaa; font-size:12px; line-height:18px; overflow:hidden} .sub _ btn {float:right; width:94px; height:28px } # msg {color:#f30} .clear {clear:both} .saylist {margin:8px auto; padding:4px 0; border-bottom:1px dotted # d3d3d3} .saylist img {float:left; width:50px; margin:4px} .saytxt {float:right; width:530px; overflow:hidden} .saytxt p {line-height:18px} .saytxt p strong {margin-right:6px} .date {color:#999}

JQuery

First introduce the jquery library and global.js file:

What global.js has to do is:

1, user input, when the mouse leaves the input box, count the number of characters entered, and output different styles (font color) on the page according to the number of input words.

2, processing submitted data: when clicking the "release" button, display the waiting picture, submit the input data through the ajax, wait for the background processing, and output the processing results to the front-end page.

The specific code is as follows:

Function recount () {var maxlen=140; var current = maxlen-$ ('# saytxt'). Val (). Length; $('.counter') .html (current); if (currentmaxlen) {$('.counter'). Css ('color','#D40D12'); $(' input.sub_btn'). Attr ('disabled','disabled') } else $('input.sub_btn'). RemoveAttr (' disabled'); if (current)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report