www.webdeveloper.com
Results 1 to 3 of 3

Thread: Why isn't this working?

Hybrid View

  1. #1
    Join Date
    Feb 2014
    Posts
    5

    Why isn't this working?

    (Html Script):

    <!DOCTYPE html>
    <html>
    <head>
    <title>Brandons Functions</title>
    </head>
    <body>
    <script type="text/javascript" src="prjs4_2.js"></script>
    <strong>This is some strong text.</strong></br>
    </body>
    <script>
    document.write(stringTwo);
    </script>
    </html>

    -----------------------------------

    (The Js Script, "prjs4_2.js")

    function twoStrings(a, b) {
    return a+' '+b;
    }
    function pointless(a){
    return a;
    }

    var stringOne = pointless(twoStrings('hi', 'there!'));
    document.write(stringOne);

    var stringtwo = twoStrings('Regular', 'text!');

    alert(stringTwo);

    ----------------------------------------

    Please help?

  2. #2
    Join Date
    Oct 2012
    Location
    Croatia
    Posts
    225
    It's a typo...

    Code:
    var stringTwo = twoStrings('Regular', 'text!');;

  3. #3
    Join Date
    Mar 2007
    Location
    localhost
    Posts
    2,035
    Typos...

    If you run a script in your browser and when the desired result does not appear to work, what you can do is start trouble shooting issues yourself by hitting the F12 key and clicking on console and ensuring that the ALL errors option is selected.

    That will tell you things like the variable is undefined or does not exist or an exception error occurred, indicating that you have a problem with a variable that you have called or function you called that does not exist.

    This is a great help to working out what is wrong with your script and will get you further faster than having to wait for someone to point out what is wrong. It will also likely score you brownie points for showing some initiative.
    Yes, I know I'm about as subtle as being hit by a bus..(\\.\ Aug08)
    Yep... I say it like I see it, even if it is like a baseball bat in the nutz... (\\.\ Aug08)
    I want to leave this world the same way I came into it, Screaming, Incontinent & No memory!
    I laughed that hard I burst my colostomy bag... (\\.\ May03)
    Life for some is like a car accident... Mine is like a motorway pile up...

    Problems with Vista? :: Getting Cryptic wid it. :: The 'C' word! :: Whois?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles