自动键入超时的文本值

时间:2014-11-28 18:31:18

标签: php jquery html

需要一些帮助n解决方案在这里..我很困惑,接下来该怎么办......其代码是:

var str = $("#text").val(),
i = 0,
isTag,
text;
(function type() {
    text = str.slice(0, ++i);
    if (text === str) return;    
    $(".myInput").val(text); 
    //$("#myInput").innerHTML = text;
    document.getElementById('myInput').innerHTML = text;
    var char = text.slice(-1);
    if( char === '<' ) isTag = true;
    if( char === '>' ) isTag = false;
    if (isTag) return type();
    setTimeout(type, 70);
}());
$.fn.allchange = function (callback) {
    var first = this;
    var last = $('#text').val().length-2;
    var infunc = function () {
        var text = $(first).val().length;
        if (text > last) {
            last = text;
            callback();
        }
        setTimeout(infunc, 100);
    }
    setTimeout(infunc, 100);
};  
$(".myInput").allchange(function () {
var last =  $('.myInput').val().length+1;
var first =  $('#text').val().length;
if(first == last){
    setTimeout(function(){
        alert(last +"="+ first);            
        //then in this line "how do i write some code" where the code can 
        //1.change to the next textarea with different value or only change the value ,
        //2.and this function will continue walking back to the beginning "continue repeated back with no stop"
    }, 10000);

    }
});

这是HTML:

<div id="myInput"></div>
<textarea class="first" id='text' style='height:400px; width:100%'>myvalue</textarea>
<textarea class="myInput" style="height:400px; width:100%" ></textarea>

怎么做??? ......怎么样?我应该创建另一个具有不同id的类textarea,还是只改变它的值?任何人都可以帮助我

0 个答案:

没有答案
相关问题