i have put together the undermentioned script. it wont output the last character of the last source. i am not very well concerned with js and that is why i ask you. can anyone give me a clue?
function jtype(source, step){
var str = source, i = 0, isTag, text, all = "", ii = 0, totallength = 0;
for(ii = 1; ii < step; ii++){
all = all + $("#source-" + ii).val();
}
(function type() {
text = str.slice(0, ++i);
if (text === str) return;
$(".steps").html(all + text);
var char = text.slice(-1);
if( char === '<' ) isTag = true;
if( char === '>' ) isTag = false;
if (isTag) return type();
setTimeout(type, 20);
}());
}
this is an example-data-source:
<input type="hidden" class="sources" id="source-1" value="Gesetzliche Zinsen gebühren kraft Gesetzes. ">
<input type="hidden" class="sources" id="source-2" value="Der gesetzliche Zinssatz beträgt nach <a href="#" onclick="dofadein('#norm330')">§ 1000 Abs 1 ABGB</a> 4 Prozentpunkte pro Jahr. ">
<input type="hidden" class="sources" id="source-3" value="Gesetzliche Zinsen sind insb die sog Verzugszinsen nach <a href="#" onclick="dofadein('#norm430')">§ 1333 ABGB</a>.">
in this example it wont output the dot at the end of #source-3. when i make an alert(source) right in the function jtype() the dot is NOT missing.
the other thing i want to know is. how can i determine the end of the output. i mean: how can i determine if the cycling is finished and the last character has been output?
thank you very much for your help and please excuse my bad english.