Forum : browser problem
Brief description  about Online courses   join in Online courses
View kavya  shree 's Profile

browser problem

Hello sir,
Actually the below code is working in google chrome... but with IE and other browsers i am getting error.... can u clear me wat is the problem with below code



<html>
<head>
<title>
hello
</title>

<script type = "text/javascript">


do
{
var n = prompt("enter the size of the array" , "n");

var num = new Array(n);
} while( n <= 0);



do

{

document.write("<br />");
document.write("Enter 1 for inerting into front" "<br />");
document.write("Enter 2 for inerting into back" "<br />");
document.write("Enter 3 for deletion form front" "<br />");
document.write("Enter 4 for deleting form back" "<br />");
document.write("Enter 0 to exit" "<br />");

var c = prompt("enter your choice" , "c");

switch (c)

{

case "1": insertfront();
break;


case "2": insertback();
break;


case "3": deletfront();
break;


case "4": deletback();
break;

case "0": return;

default: alert("An error occurred, so we are staying here");

}


} while(c != 0);




function insertfront()
{
if(num.length > n)
{
alert(" array is full cant insert");
return;
}



num.unshift(Math.round((Math.random()*49) 1));
document.write("<br />");
document.write("The new array is" "<br />");

for(i = 0; i<num.length; i )
{
document.write(num[i]);
document.write("
Asked by kavya shree | Sep 27, 2010 |  Reply now
Replies (0)