the following code when browsed in firefox/MS edge/ IE11 outputs in the browser ” The rate is 1.2345/the rate is 2.0345 etc’)
[CODE]
<script type=”text/javascript”>
function CalDR(){
x = new Date(2007,10,31).getTime();
y = new Date(2012,9,31).getTime();
x1= new Date (2012,10,01).getTime();
y1=new Date().getTime();
var refDate1=document.DR.DOR.value;
refDate=new Date(refDate1).getTime();
var caseTest=0;
if (refDate >= x && refDate<=y) caseTest=1;
if (refDate >= x1 && refDate<=y1) caseTest=2;
switch(caseTest){
case 1:
rate= 1.2345;
// alert (rate);
alert(“rate is “+ rate);
document.write(“<h1>rate is </h1>” + rate);
break;
case 2:
rate= 2.0345;
alert(rate);
document.write (“rate is” +rate);
break;
default: document.write(“exit..exit”);
break;
}
}
</script>
<form name =”DR” >
enter Date of Retirement:<BR/>
<input name=”DOR” type=”date” > <br>
<input type=”submit” value=”Submit” onclick=”CalDR()” >
</form>
However the same code when run in Chrome browser does not proceed beyond alert( rate ), and does not show the contents inside the document.write (“the rate is “+ rate);where as other browsers show the content inside document.write() in respect of case1 and case2 of the switch statement. Default output inside document.write(exit..exit) is shown in all the browsers including chrome.
what steps can be taken so that document.write() contents are shown in chrome also. If not possible what are the alternatives.
please advise.
thanks
regards
vkwd7