Reputation: 841
In my project, I have a problem for href.
my html page is a.php, and its code is :
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="shortcut icon" href="favicon.ico" />
<link rel="stylesheet" type="text/css" href="http://www.ulpin.com /css/bootstrap.min.css">
<style>
dd{word-wrap:break-word;};
</style>
<title>SystemTitle</title>
<script type="text/javascript" src="static/js/jquery-1.7.2-min.js"> </script>
<script type="text/javascript" src="static/js/bootstrap.min.js"></script>
<base target="_self"/>
</head>
<body>
<br/>
<br/>
<br/>
<br/>
<div class="container">
<center>
<a href="active.php" class="btn">ManTest</a><br/><br/>
</center>
</div>
</body>
</html>
But it works fail. So I checked the page source code with firefox, When I click the href of static/js/jquery-1.7.2-min.js, it shows:
Not Found
The requested URL /o1ws1v/web/admin/static/js/jquery-1.7.2-min.js was not found on this server.
The src is changed. "/o1ws1v/web/admin/" is added auto.
Why?
My fold struct is :
/yjdata/www/www/o1ws1v/web/admin/a.php
/yjdata/www/www/o1ws1v/web/static/js/jquery-1.7.2-min.js
/yjdata/www/www/o1ws1v/web/static/js/bootstrap.min.js
Otherwise, a.php is put in /yjdata/www/www/o1ws1v/web/, it works OK
Who can help me?
Upvotes: 0
Views: 49
Reputation: 2209
This is a simple problem of paths.
When you are under /yjdata/www/www/o1ws1v/web/admin/a.php
and use src="static/js/jquery-1.7.2-min.js"
, this is waht happens :
--/yjdata/www/www/o1ws1v/web/admin/
| |--- a.php <-- You are here
| |--- static/ <-- This is where the browser think that the static folder exists
|--- static/ <-- This is where the folder really is !
So, what you need to do in the a.php
is to go up a level in the src path :
<script type="text/javascript" src="../static/js/jquery-1.7.2-min.js"> </script>
The ..
to indicate the parent directory.
Upvotes: 1