.
.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
   <script type="text/javascript">
   function cubeme(incomingnum){

           if (incomming == 1) {
               return "what are u doin?";
           }
           else {
               return Math.pow(incomingnum, 3);
           }
       }

   </script>
    <title>this project cubes a number</title>
</head>

<body>

    <script type="text/javascript">
        var thenum = 2;
        var finalnum = cubeme(thenum);
        if (isNaN(finalnum)){
            alert("you should know that 1 to any power is 1");
        }
        else {
            alert("when cubed,"+thenum+"is"+finalnum);
        }
        alert("shit");
    </script>
</body>
</html>

when i browse this code,non of the browsers show the alert box!i wanna know whyyyy???
and the other question is that when i use "start without debugging",a kind of website about asp is shown or some times a page titled:HTTP Error 403.14 - Forbidden.... . but no signs of my code debugging!! It's making me crazy.i need helP!

Recommended Answers

All 6 Replies

What are in the first 2 lines (with dots)? Also, your html tag could simply be a tag without xmlns property (unless you are dealing with some xml). Also, your variable incomingnum is wrong in your if statement in line 9.

it's ok now and working in Eclipse web browser but what is wrong with my pc browsers which can NOT show the alert boxes?? why my VS debugger is out of order?

I have no idea about your debugger. The only clue you talked about with 403 which indicates the page you try to view does not have read permission for world. If you are familiar with permission, there are 3 sets of permission - user, group, and world. You have to look at how you set it up and allow world to read it; otherwise, you will get 403 (forbidden).

@wazz, isNaN() is working correctly in this case -- is Not a Number. The function works pretty well even with undefined value (return true). The OP checks whether the return value is a number. If it is not a number, alert a fixed message; otherwise, alert the cube value of the number.

"ou have to look at how you set it up and allow world to read it; otherwise, you will get 403."
then how should i set it up for world permision?

What type of server are you using? What technology/language are you using? Do you have full access to your server (at least admin privilege)?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.