假设有一个图片的绝对地址:
<img src="http://www.w3schools.com/images/smile.gif" />
Now we insert the <base> tag, which specifies a base URL for all of the links in a page, in the head section of a page:
现在我们插入<base>标签,就可以为页面内的所有连接加上基础URL:
<head>
<base href="http://www.w3schools.com/images/" />
</head>
When inserting images on the page in the example above, we just have to specify the relative address, and the browser will look for that file using the full URL, "http://www.w3schools.com/images/smile.gif":
加上之后我们只需要指定相对的地址就可以将URL变为"http://www.w3schools.com/images/smile.gif":
<img src="smile.gif" />
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/ai_33/archive/2008/04/07/2256213.aspx
<img src="http://www.w3schools.com/images/smile.gif" />
Now we insert the <base> tag, which specifies a base URL for all of the links in a page, in the head section of a page:
现在我们插入<base>标签,就可以为页面内的所有连接加上基础URL:
<head>
<base href="http://www.w3schools.com/images/" />
</head>
When inserting images on the page in the example above, we just have to specify the relative address, and the browser will look for that file using the full URL, "http://www.w3schools.com/images/smile.gif":
加上之后我们只需要指定相对的地址就可以将URL变为"http://www.w3schools.com/images/smile.gif":
<img src="smile.gif" />
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/ai_33/archive/2008/04/07/2256213.aspx