我想制作一个javascript文件上传器。此上传器的css位置是“〜/ Scripts / fileuploader / fileuploader.css”,js位置是“〜/ Scripts / fileuploader / fileuploader.js”。我想做以下事情:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="~/Scripts/fileuploader/fileuploader.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="demo"></div>
<ul id="separate-list"></ul>
<script src="~/Scripts/fileuploader/fileuploader.js" type="text/javascript"></script>
<script>
function createUploader() {
var uploader = new qq.FileUploader({
element: document.getElementById('demo'),
listElement: document.getElementById('separate-list'),
action: '~/Scripts/fileuploader/do-nothing.htm'
});
}
window.onload = createUploader;
</script>
</body>
</html>
但是,<link href="~/Scripts/fileuploader/fileuploader.css"
和<script src="~/Scripts/fileuploader/fileuploader.js"
成为http://localhost:1304/Administration/blue/en-gb/Entity/Index/~/Scripts/fileuploader/fileuploader.js?_=1325540158292
和http://localhost:1304/Administration/blue/en-gb/Entity/Index/~/Scripts/fileuploader/fileuploader.js
?
如何更改此内容以使其~/Scripts/fileuploader/fileuploader.js
而不是http://localhost:1304/Administration/blue/en-gb/Entity/Index/~/Scripts/fileuploader/fileuploader.js
答案 0 :(得分:0)
为什么你需要把那个〜符号放到那里?如果您的html文件(或我不知道的php)位于您使用该符号的位置,删除〜/符号将解决问题。
<link href="Scripts/fileuploader/fileuploader.css" rel="stylesheet" type="text/css">
<script src="Scripts/fileuploader/fileuploader.js" type="text/javascript"></script>