innerHTML problem

0 comments

Hi to all. I have a task wich i show you in the end of message.
My problem is coming from innerHTML.
Under firefox and chrome everything is OK but when i start it under IE7 and above nothing happend.
This is my code :
this is in JS file:

function validate(param) {

if(param.length >=3) { ////show the parameter and check it for minimal lenght in the entry of the text field
var regex = /^(d+)-(d+)$/i; // create regular expression that we use for our purposes
//var regex = /(d+)(.(d+))*(/(d+))*-(d+)$/ ;

var match = regex.exec(param);
if(match !== null) { //check if we have a coincidence
var select = generateSelecte(match[1], match[2]); //call the function with the two elemets, two numbers
if(select !== false) { //if we have some result
document.getElementById(“mineSelect”). innerHTML = select; //in DOM we put the checkd result
}
}
else {
alert(‘The use value “‘+param+'” is not valid’);
}
}
else {
return false;
}
}
function generateSelecte(el1 , el2) {
   el1 = parseInt(el1);
   el2 = parseInt(el2);
   var DOMselect = ”;  // empty string
   if(el1 < el2) { //when first number is lower we have positiv incrementation
     for(var k = el1; k <= el2; k++) {
       DOMselect = DOMselect + ‘<option value=’+k+’>’+k+'</option>’; // на всеки елемент добавяме нов елемент оптионс за всяко въртене на цикъла
     }//on every element we add new options for every rotation in to the LOOP
     return DOMselect;
   }
   else if(el1 > el2) {
     for(var k = el1; k >= el2; k–) { //negative, subtrac 1
       DOMselect = DOMselect + ‘<option value=’+k+’>’+k+'</option>’;
     }
     return DOMselect;
   }
   else {
     return false;
   }
}

this is in HTML file
<html>
<head>
<title></title>
<script type=”text/javascript” src=”general.js”></script>

</head>
<body>

<div id=”masterParent”>

<div id=”message”></div>
<form>

<input style=”width:200px; height: 35px; line-height: 35px;
color: green; border-radius: 3px; border: 1px solid silver;” type=”text”
id=”inputText” name=”cifri” placeholder=”Please fill with mask ‘dd-dd'”
/>
<span id=’select’>
<select name=”select4e” id=”mineSelect”>
<option>Please fill the require field</option>
</select>
</span>
<!– When you click the button, he trigger onClick and call function ‘validate’ and take the result in tekst field –>
<input type=”button” name=”button” value=”validate and set”
onclick=”validate(document.getElementById(‘inputText’).value)” />
</form>
</div>

</body>
</html>

About the Author

Follow me


{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}