SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast MartyBoi's Avatar
    Join Date
    Dec 2011
    Location
    Saginaw MI
    Posts
    53
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Help! Linking To JavaScript

    Hello, how are you?

    I am having a little issue, well may a major issue. Lol....

    I am designing a WordPress Custom Home Page, and I have an External Javascript file, ' function.js ' to be exact.

    Anyways, here is the code:
    Code:
    // remap jQuery to $
    (function($){})(window.jQuery);
    
    
    // your functions go here
    	
    
    });
    
    
    /* optional triggers
    
    $(window).load(function() {
    	
    });
    
    $(window).resize(function() {
    	
    });
    
    */
    I am interested in knowing how to call a function from this file. Can someone please help me?

    Also, is there a way I can call this function as well:

    Code:
    <p id="date">
                    	<script language="javascript">
    					
                    	// Today's Date function
    						var now=new Date();
    						var days=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
    						var months=new Array('January','February','March','April','May','June','July','August','September','October','November','December');
    						var date=((now.getDate()<10)? "0" : "")+ now.getDate();
    		
    						function fourdigits(number){
    		
    						return(number<1000)? number+ 1900:number;
    			
    				}
    			
    						today= days[now.getDay()] + " , "  + months[now.getMonth()] + "  "  + date + " , " +  (fourdigits(now.getYear()));
    						
    						document.write(today);
    						
    					</script>	
    				</p>
    Thank you

  2. #2
    SitePoint Evangelist
    Join Date
    Jun 2010
    Posts
    455
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    javascript functions are most usually called by events http://www.w3schools.com/js/js_events.asp


Bookmarks

Posting Permissions

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