SPAN tag values without refreshing style changes (using AJAX technology)

2010-09-28  来源:本站原创  分类:Web  人气:128 

Calling code

<span  value="hello"> hello
</span>

to achieve the following javascript code

<script type="text/javascript">
                        var req;
                        var gID;
                        function changeToInput(id) {//
                                var oNP = document.getElementById(id);
                                var value = oNP.value;
                                oNP.outerHTML = "<input type='text' value='" + value + "' size='5'>";
                                document.getElementById(id).focus();
                        }

                        function change(id) {
                                var oNP = document.getElementById(id);
                                var value = oNP.value;
                                gID = id;
                                init();
                                var url = "ChangePrice.jsp?id=" + escape(id) + "&normalprice=" + value;
                                req.open("GET", url, true);
                                req.onreadystatechange = callback;
                                req.send(null);

                        }

                        function init() {
                                if(window.XMLHttpRequest) {
                                        req = new XMLHttpRequest();
                                } else if (window.ActiveXObject) {
                                        req = new ActiveXObject("Microsoft.XMLHTTP");
                                }
                        }

                        function callback() {
                                if(4 == req.readyState) {

                                        if(200 == req.status) {

                                                var oNP = document.getElementById(gID);
                                                var value = oNP.value;
                                                oNP.outerHTML = "<span value='" + value + "'>" + value + "</span>";
                                        }
                                }

                        }

                </script>
相关文章
  • SPAN tag values without refreshing style changes (using AJAX technology) 2010-09-28

    Calling code <span value="hello"> hello </span> to achieve the following javascript code <script type="text/javascript"> var req; var gID; function changeToInput(id) {// var oNP = document.getElementById(id); var valu

  • Struts2 iterator tag values using <s:iterator> 2011-01-11

    ----------------------------------------------------------sturts.xml <action name="FindAllusersAction"> <result name="list">/list.jsp</result> </action> ---------------------------------------------------------

  • J-HI rapid development platform 2011-01-14

    rapid development platform J-HI official website: http://www.J-HI.net What is J-HI J-HI is a JAVA WEB rapid development of open source software platform, primarily serving the software enterprises and traditional industries, enterprises and instituti

  • Rails around the platform to talk about the development of loosely coupled technology 2010-06-11

    Loose coupling, is to start learning to do procedures should be some ideas. For example: 1. Development of class time to function as a single, rather small do not do big. 2. Methods are still required as much as possible not to extend too much functi

  • CSS style combat WAP handsets 2010-03-29

    1. In the div tag you can use the line-height property, other labels do not use the best 2. For more information on the page to add background images, due to a variety of cell phone does not fit, should be united in the div tag by adding background i

  • the difference between span and div 2010-10-16

    span tag can not be used outside the table, reported a warning; with div on it. span and div is the difference between the span is inline, with a small inline in the HTML, before and after the continued line. div (mean think about division) element i

  • In HTML, DIV and SPAN difference 2010-10-21

    SPAN and DIV difference is, DIV (division) is a block-level element can contain paragraphs, headings, tables, and even such as chapters, abstracts and notes and so on. The SPAN is inline elements, SPAN will not change before and after the line, meani

  • CMS custom label ArtiList date formatting style and articles 2010-10-22

    1. Custom Label ArtiList When the call to the label [@ cms.ArtiList sysTpl = '0 '/] This is one of the sysTpl = '0 'custom tag that calls the style is to call / template / article / default / tag_ArtiList.html the style of this document Contents of t

  • Empty fileupload control values with JS 2010-11-10

    1. On how to use the script to modify the value of the fileupload control problem Development environment, vs2005, uploading files, you need a Cancel button to clear the type = file's value, and this page have more than one file controls This is too

  • struts2 ajax verify the existence of input values 2009-03-07

    struts2 ajax verify the existence of input values Today to do the struts2 ajax validate input regarding the existence of the function, and now share with everyone, I hope everyone many opinions!!! input.jsp page code: <html> <body> <s:form

  • Facelets UI Tag Reference 2010-03-18

    Reproduced】 【http://lalalabs.blog.163.com/blog/static/943252022009113693235/ ui: composition UI Composition tag is a template tag, its content is listed in the package in another Facelet. Any content outside the UI Composition tag will be ignored Fac

  • Display Tag with small mind 2010-03-31

    With a period of Display Tag, find it very easy to use, can be found at the forum who like to use very little of this stuff, that Ouye Lai write articles. Display Tag Lib is a tag library, to handle jsp pages Table, features very strong, can be paged

  • style. currentStyle. runtimeStyle Introduction 2010-06-01

    1, the basic concepts used: Inline style (inline Style): Tag is written inside, inline style is only valid on all Tag. eg: <P> the Style definitions <p> </ p> inside the text is 20pt font, font color is red. </ P> Internal style (i

  • Flex components: Style in the use of 2010-11-09

    Comparison of the style sections of the trivial, there is no more difficult part, with examples of bad shows, put the application in the flex style summary of all relevant text into a demonstration inside the left of the tree are listed in the docume

  • struts2 tag library components --- 2010-11-27

    The composition of Struts2 tag library strut2 Framework tag library can be divided into the following three categories * User Interface Tags (UI Tags): The main elements used to generate HTML tags. * Non-User Interface Tags: mainly used for data acce

  • JS in style.width [transfer] 2010-12-17

    http://www.cftea.com/c/2006/12/BFLZYKFAY1RZXDDQ.asp Of: chilleen Source: Thousand a network (original) :2006-12-12 JS also can control the style sheet, but IE and FF (FireFix) this explanation is slightly different to style.width example. IE id.style

  • Android Introduction and Theme sixteenth chapter of Style 2011-01-13

    More and more Internet companies are in the deployment of its Android platform clients, in order to enhance the user experience, these clients have done a reasonable layout and good looking ....... Android's Style Design is one of the keys to enhance

  • Introduction to the sixteenth chapter of Style Android and Theme (rpm) 2011-01-14

    More and more Internet companies are in the deployment of its Android platform clients, in order to enhance the user experience, these clients have done a reasonable layout and good looking ....... Android's Style Design is one of the keys to enhance

  • Android入门之Style与Theme用法实例解析 2014-04-24

    这篇文章主要介绍了Android入门之Style与Theme用法,非常实用的功能,需要的朋友可以参考下 就目前的互联网发展来看,已经有越来越多互联网企业都在Android平台上部署其客户端,并且为了提升用户体验,这些客户端都做得布局合理而且美观.本文所要介绍的Android的Style设计就是提升用户体验的关键之一.Android上的Style分为了两个方面: 1.Theme是针对窗体级别的,改变窗体样式: 2.Style是针对窗体元素级别的,改变指定控件或者Layout的样式. Android

  • php实现根据词频生成tag云的方法 2014-08-05

    这篇文章主要介绍了php实现根据词频生成tag云的方法,涉及php分析与操作字符串以及标签云的生成技巧,具有一定参考借鉴价值,需要的朋友可以参考下 本文实例讲述了php实现根据词频生成tag云的方法.分享给大家供大家参考.具体如下: 这里给定一段文本,分析文本的词频分布,生成tag云 <?php /** * Tag cloud demo based on word frequency * @author: unknown * @since: 2007-02-27 */ // Store freq