Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Javascript Problem

  • 30-03-2007 4:12am
    #1
    Registered Users, Registered Users 2 Posts: 1,987 ✭✭✭


    This is the code in the head of the html page:
    <script type="text/javascript">
    <!--
    function date()
    {
    	var day = getDate();
    	var month = getMonth();
    	var year = getFullYear();
    	document.write(day+"/"+month+"/"+year); 
    }
    //-->
    </script>
    

    And this is the code in the body of the html page but nothing is coming up on screen:
    <script type="text/javascript">
    <!--
    	date();
    //-->
    </script>
    


Comments

  • Registered Users, Registered Users 2 Posts: 3,594 ✭✭✭forbairt


    Looks like you forgot to create your date object :)

    var d = new Date();

    or similar ...

    getDate and so on .. are Methods ... not standalone functions ..

    hope that helps

    <script type="text/javascript">
    <!--
    function date()
    {
    	var d = new Date();
    	var day = d.getDate();
    	var month = d.getMonth();
    	var year = d.getFullYear();
    	document.write(day+"/"+month+"/"+year); 
    }
    //-->
    </script>
    
    <script type="text/javascript">
    <!--
    	date();
    //-->
    </script>
    


  • Registered Users, Registered Users 2 Posts: 568 ✭✭✭phil


    TIP #76: Use Firefox for development and at the very least use the Javascript console. Preferably use Firebug for debugging Javascript.

    Firebug - Sexual chocolate for web developers.


  • Registered Users, Registered Users 2 Posts: 7,468 ✭✭✭Evil Phil


    Venkman is a great javascript debugger for Firefox.


  • Registered Users, Registered Users 2 Posts: 1,987 ✭✭✭Ziycon


    Nice one lads, got it sorted, i dont usually use JS but i cant use JSP,PHP or ASP on the project in doing!


Advertisement