Saturday, April 23, 2016

Comparing values

There are lot of dom methods  which are not being supporting by IE 11.I was having task to find the values greater then 21 from html text-box and the dom methods are not going fine for me in IE browser,So by using for loop found the solution

<!DOCTYPE html>
<html>
<body>
<p id="demo"></p>
<input type="text" id="myDate" value="15,24,26">
<script>
alert("In Script");
var text = ""; var text1= "";
var i; var comma=",";
alert("Came out of comma"); var x = document.getElementById("myDate").value;
alert("Length of the Date is .."+x.length);
for (i = 0; i < x .length; i++)
{
  text += x[i];
  text1=x[i+1];
  alert("Now Text Value is.."+text+"And text 1 is.."+text1+"And i is.."+i);
   if(comma == text1)
     {
  alert("\nNow in Comma State and Text Value is.."+text+"\nAnd text 1 is.."+text1+"\nAnd i is.."+i);  
    if(text>= 21)
        {
document.getElementById("demo").innerHTML = text +"....GREATER THE 21"
       text=" ";i++;
         }
        else
         {
          text=" ";i++;
         }
      }
   else
      {
   alert("text1 is not comma so checking for text which is.."+text);
        if(text>= 21)
        {
document.getElementById("demo").innerHTML = text +"\n....GREATER THE 21"
 
         }
      }
}
</script>
<p id="demo"></p>
</body>
</html>

Wednesday, April 20, 2016