Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jun 2008
    Posts
    67
    Thanks
    18
    Thanked 0 Times in 0 Posts

    Another Basic Question

    i have been writing scripts for my site and i am doing ok. i have a few basic questions
    1 is there a order you have to write a script for it to work right?
    (example-- style javascript,head,body)
    2 where is the best place to get examples of scripts for special effects and learn more or best place for resourses other than spending all this money on books?(wife is getting mad!!!!)
    3 is there software or a way to find out is scripts on the same page are conflicting or working againest each other?
    4 does every script have to be downloaded to the directory or can i just include it in the htlm page?

  • #2
    Regular Coder FWDrew's Avatar
    Join Date
    Apr 2008
    Location
    Missouri
    Posts
    380
    Thanks
    38
    Thanked 45 Times in 43 Posts
    Hi Howardfan123,

    1 is there a order you have to write a script for it to work right?
    (example-- style javascript,head,body)
    A typical HTML page with Javascrip might look like this:
    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
       "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
    
    
    	<head>
    <script type="javascript">
    <!--
    function Example() {
    alert("Dont use pop-ups ever!");
    }
    //-->
    </script>
    <meta content="text/html;charset=utf-8" http-equiv="Content-Type"/>
    <meta name="copyright" content="date | your name or name of company" />
    <meta name="author" content="" />
    <meta name="keywords" content=" " />
    <meta name="description" content=" " />
    		<title></title>
    <style type="text/css">
    
    </style>
    	</head>
    	<body>
    <h1>A header</h1><br />
    <input type="button" onclick="Example()" value="Test Button" />
    <p>Some text.</p>
    	</body>
    </html>
    You will notice the Javascript is placed in the <head> tags, you can place JavaScript in the Body or Head tags (or both). The advantage of placing JS in the head tags is that it will be loaded before the rest of the page is.


    2 where is the best place to get examples of scripts for special effects and learn more or best place for resourses other than spending all this money on books?(wife is getting mad!!!!)
    Google. Seriously though there are millions of great sites, however, here are 2 very good ones for learning and free scripts and examples:
    http://w3schools.com
    http://hotscripts.com
    (Also, a shamless plug of a site I write for, the link in my sig has a lot of helpful tutorials for web developers).

    3 is there software or a way to find out is scripts on the same page are conflicting or working againest each other?
    If you fully understand what your scripts are doing, you shouldnt run into many problems. I dont know of any software that does this, just follow good coding practice when writing scripts and you should be fine.

    4 does every script have to be downloaded to the directory or can i just include it in the htlm page?
    Every script will have to be put on your server through FTP. If the script is on the HTML page, then obviously it is uploaded to the server when you upload the page. If, for example, you have a php include script, you will need to FTP that to your server in whatever directory the file is pointed to.

    Hope that helps, best of luck to you

    Regards,

    Drew
    Dev-Tips.com || Employee at the Envato Network || My Portfolio

  • Users who have thanked FWDrew for this post:

    howardfan123 (07-11-2008)


  •  

    Posting Permissions

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