Question about attaching css and js file to webpage?

siamandm
5StarLounger
Posts: 1192
Joined: 01 May 2016, 09:58

Question about attaching css and js file to webpage?

Post by siamandm »

Hello All

i have a web page on my local machine , which works fine the formats and the js codes, but when i copy them to my host seems to be something goes wrong...

the web page is saved in this locatin
inside My Documents > My Web Site > Database >PIM> Test.html

the js and css are saved in this location

My Documents > My Web Site > Database >Themes> Defualt >css
My Documents > My Web Site > Database >Themes> Defualt >js


the way the style sheet attached to the page

Code: Select all

 <link href="../Themes/default/css/reset.css" rel="stylesheet" type="text/css">

Code: Select all

<script type="text/javascript" src="../js/main.js" charset="UTF-8"></script><script type="text/javascript">
the path for images folder : C:\Users\Dell\Documents\My Web Sites\Database\Themes\default\images
and inside the css file , the url for the images as below :

Code: Select all

 color:#f28c38;
    background: url(../images/help-down.png) no-repeat center right;
    padding:2px 15px 1px 1px;

so what should i change inside my host folder , in order to work as the local server.

regards

User avatar
Sam1085
3StarLounger
Posts: 318
Joined: 23 Aug 2016, 07:43
Location: Sri Lanka

Re: Question about attaching css and js file to webpage?

Post by Sam1085 »

Hi Siamandm,

Seems like no issues in folder structure or references.

Did you try to copy/upload 'My Web Site' folder as a zip file?
-Sampath-

siamandm
5StarLounger
Posts: 1192
Joined: 01 May 2016, 09:58

Re: Question about attaching css and js file to webpage?

Post by siamandm »

no I copied the subfolders inside Database folder in to my website.

regards

User avatar
Sam1085
3StarLounger
Posts: 318
Joined: 23 Aug 2016, 07:43
Location: Sri Lanka

Re: Question about attaching css and js file to webpage?

Post by Sam1085 »

Hi Siamandm,

I've experience with cPanel and Plesk server management tools. I've no idea about other systems and servers. But this method should be work if you set a domain into your server correctly in cPanel or Plesk.

Tr this:

01. Change this lines as follows:

Code: Select all

<script type="text/javascript" src="../Themes/default/js/main.js" charset="UTF-8"></script><script type="text/javascript">
02. Change Image folder CSS files as follows:

Code: Select all

color:#f28c38;
        background: url(../Themes/default/images/help-down.png) no-repeat center right;
        padding:2px 15px 1px 1px;
03. Create a zip file for "My Web Site" folder. (Recommended method if you don't use Filezilla or other FTP application to upload multiple folders)

04. Upload/Copy into your hosting server

05. Extract the zip file
-Sampath-

siamandm
5StarLounger
Posts: 1192
Joined: 01 May 2016, 09:58

Re: Question about attaching css and js file to webpage?

Post by siamandm »

thank you for the reply,
the host is on godaddy sever, and I'm using Filezilla to upload the files .. but still not working .

regards

User avatar
Sam1085
3StarLounger
Posts: 318
Joined: 23 Aug 2016, 07:43
Location: Sri Lanka

Re: Question about attaching css and js file to webpage?

Post by Sam1085 »

Hi siamandm,
Hosting Server and local server works as same. If locally view your site correctly, the same result will be show you in server too.

As I mentioned earlier please try to create a zip file and upload via FileZilla. (Don't upload files one by one).

Make sure you have uploaded your files into the "public_html" folder.

After that you have to access cPanel >> File Manager >> public_html to extract (UnZip). FTP (Like Filezilla) has no functionality for remote ZIP extraction.

Did you configure a domain with your hosting server? If yes, Hope this will help you.
-Sampath-

Becks
2StarLounger
Posts: 196
Joined: 31 Mar 2011, 03:41
Location: Perth, Western Australia

Re: Question about attaching css and js file to webpage?

Post by Becks »

Check the file structure name on the server again
../Themes/default/images/
is NOT the same as
../themes/default/images/
on a UNIX based server

Regards
Kevin