...

View Full Version : Another Basic Question



howardfan123
07-11-2008, 05:35 AM
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?

FWDrew
07-11-2008, 07:30 AM
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:


<!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



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum