SWFObject 相对路径

发布于 2024-12-07 16:31:52 字数 1133 浏览 0 评论 0原文

无论我尝试什么,我都无法使这个 swf 文件工作。 如果我将所有文件放入我的根目录中,一切都会正常工作。

这是我的路径格式;

root:我的index.php 所在的位置。

在根目录中,我有一个名为“public”的文件夹。

在“public”内,我有另一个名为“_carousel_flash”的文件夹。 这是我的 swf 文件所在的位置。 我在这个目录中还有“js”文件夹。

这是我用于添加 swf 文件的 html 代码。

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>

<title>Galleria - Inspire Creativity</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="public/_carousel_flash/js/swfobject.js"> </script>
<script type="text/javascript" src="public/_carousel_flash /js/swfaddress.uncompressed.js"></script>

</head>

<body>

<div id="contents">
</div>

<script type="text/javascript">
var so = new SWFObject("public/_carousel_flash/block_slider.swf", "movie", "100%", "100%", "8", "#ffffff");
so.addParam("quality", "high");
so.addParam("id", "movie");
so.addParam("allowFullscreen", "true");
so.write("contents");
so.addParam("salign", "t");
</script>
</body>

</html>

Whatever I try I couldn't make this swf file work.
if I put all the files into my root everything works perfectly fine.

Here is my path format;

root: where my index.php located.

inside the root, I have a folder called "public".

inside "public" I have another folder called "_carousel_flash".
This is the place where my swf file is located.
I also have "js" folder located in this directory.

Here is the html code I'm using for adding the swf file.

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>

<title>Galleria - Inspire Creativity</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="public/_carousel_flash/js/swfobject.js"> </script>
<script type="text/javascript" src="public/_carousel_flash /js/swfaddress.uncompressed.js"></script>

</head>

<body>

<div id="contents">
</div>

<script type="text/javascript">
var so = new SWFObject("public/_carousel_flash/block_slider.swf", "movie", "100%", "100%", "8", "#ffffff");
so.addParam("quality", "high");
so.addParam("id", "movie");
so.addParam("allowFullscreen", "true");
so.write("contents");
so.addParam("salign", "t");
</script>
</body>

</html>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

巨坚强 2024-12-14 16:31:52
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>

<title>Galleria - Inspire Creativity</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="public/_carousel_flash/js/swfobject.js"> </script>
<script type="text/javascript" src="public/_carousel_flash /js/swfaddress.uncompressed.js"></script>

</head>

<body>

<div id="contents">
</div>

<script type="text/javascript">
var so = new SWFObject("public/_carousel_flash/block_slider.swf", "movie", "100%", "100%", "8", "#ffffff");
so.addParam("quality", "high");
so.addParam("id", "movie");
so.addParam("allowFullscreen", "true");
so.write("contents");
so.addParam("salign", "t");
</script>
</body>

</html>

PUBLIC拼写错误

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>

<title>Galleria - Inspire Creativity</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="public/_carousel_flash/js/swfobject.js"> </script>
<script type="text/javascript" src="public/_carousel_flash /js/swfaddress.uncompressed.js"></script>

</head>

<body>

<div id="contents">
</div>

<script type="text/javascript">
var so = new SWFObject("public/_carousel_flash/block_slider.swf", "movie", "100%", "100%", "8", "#ffffff");
so.addParam("quality", "high");
so.addParam("id", "movie");
so.addParam("allowFullscreen", "true");
so.write("contents");
so.addParam("salign", "t");
</script>
</body>

</html>

PUBLIC spell mistake

凉宸 2024-12-14 16:31:52

否则我猜

Or else i guess <script> tag is causing some issues, try embedding your swf object file

野心澎湃 2024-12-14 16:31:52

我无法确定是什么导致了您的错误,但我注意到您的代码有以下几点:

您使用的是 SWFObject 1.x,它非常过时,并且使用与 SWFObject 2.x 不同的语法。您是否有适用于 SWFObject 1.x 的正确 swfobject.js 文件?对于 SWFObject 用户来说,这是一个相当常见的问题。

在 SWFObject 1.x 中,您无法在 so.write 语句之后添加 addParam...它不会反映在您的页面中。

so.write("contents");
so.addParam("salign", "t");

应该是

so.addParam("salign", "t");
so.write("contents");

SWFAddress 的 URL 中有一个拼写错误(“/js/”之前有一个空格)。

如果您想确保 SWF 位于根目录中,请尝试使用绝对 URL 直接在浏览器中加载它。

说到绝对 URL,在 SWFObject 代码中尝试它们通常也很有帮助。您当前的 URL 是文件相关的;我建议使用站点相对 URL ("/foldername/filename.swf") 或绝对 URL ("http://yourdomain.com/foldername/filename.swf"< /代码>)。

I can't be sure what's causing your error, but here are some things I notice about your code:

You're using SWFObject 1.x, which is very outdated and uses different syntax than SWFObject 2.x. Do you have the correct swfobject.js file for SWFObject 1.x? This is a fairly common issue for SWFObject users.

In SWFObject 1.x, you can't addParam after the so.write statement... it will not be reflected in your page.

so.write("contents");
so.addParam("salign", "t");

should be

so.addParam("salign", "t");
so.write("contents");

You have a typo in the URL for SWFAddress (a space just before "/js/").

If you want to be sure your SWF is located in the root, try loading it directly in the browser using the absolute URL.

Speaking of absolute URLs, it's often helpful to try them in your SWFObject code, too. Your current URL is file-relative; I suggest either using a site-relative URL ("/foldername/filename.swf") or an absolute URL ("http://yourdomain.com/foldername/filename.swf").

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文