jQuery 内联脚本在 Firefox 4 中不起作用

发布于 2024-11-14 13:49:04 字数 2205 浏览 3 评论 0原文

我今天下载了 Firefox 4,发现我的网站无法按预期运行。当我在互联网上寻找答案时,我发现了需要通过

document.write('

我将所有内联代码复制并粘贴到外部文件中,这就是我现在添加内联脚本的方式(在所有浏览器中工作,部分在 firefox 4 中工作):来自有关标记的评论查询,我这里是链接: http://filetaxes4free.com/temporary/index.php

<script language="JavaScript">

    document.write('
        <script src="path/js/inlineScript.js" 
                type="text/javascript">
        <\/script>'
    );

</script>

我正在使用 jQuery 1.6.1,jQuery 选项卡(在代码中您可以看到它们通过不透明度切换设置为旋转和淡入/淡出)一些 jQuery 正在工作,有些则不工作;当事件 mouseover 和 mouseout 不起作用时文件名的更改,以及当事件 mouseover 和 mouseout 不起作用时的动画(这是 inlineScript.js 文件的内容)

jQuery(document).ready( function() {
    jQuery( "#tabs" ).tabs().tabs({  
        fx: { opacity: 'toggle', duration: 1000 }}
    ).tabs('rotate', 3500, false);

    jQuery("ul#frontModule li a img").live('mouseover mouseout', function() {

        var fileName = jQuery(this).attr('src').search("-active");

        if (event.type == 'mouseover' && fileName == -1 ) {
            jQuery(this).attr("src", jQuery(this).attr("src")
                .replace(".png","-active.png"));
        }
        else {
            jQuery(this).attr("src", jQuery(this).attr("src")
                .replace("-active.png",".png"));
        }
    });

    /* LOGO anitmated text*/

    jQuery( "#logo" ).airport(
        [ 'small business web design', 
            'online marketing', 
            'search engine optimization', 
            'websonalized-com']
    );

    //menu animation

    jQuery('#rightBody .menu li a').live('mouseover mouseout', function(){

        if ( event.type == 'mouseover' ) 
            jQuery(this).animate({ marginLeft: "15px" }, 500 );
        else 
            jQuery(this).animate({marginLeft: "0" }, 500 );
    });

    //css for IE css3pie.com
    if (window.PIE) {

        //jQuery('.rounded').each(function() {
            //PIE.attach(this);
        //});

        jQuery('.roundRightEI').each(function() {
            PIE.attach(this);
        });

    }//end IE scripts
});

我需要对此进行哪些更改在 Firefox 4 中运行的脚本

I downloaded Firefox 4 today, and realized my site does not work as expected. As I looked for answers over the internet, I found solutions that called for adding the inline script by way of

document.write('<script src="path/js/inlineScript.js" type="text/javascript"><\/script>').

I copied and pasted all of my inline code to an external file, and this is how I am adding the inline script now (working in all browsers, and partially in firefox 4): from comments inquiry regarding the markup, I here is the link: http://filetaxes4free.com/temporary/index.php

<script language="JavaScript">

    document.write('
        <script src="path/js/inlineScript.js" 
                type="text/javascript">
        <\/script>'
    );

</script>

I am using jQuery 1.6.1, jQuery tabs (in code you can see they are set to rotate and fadein/fadeout through opacity toggle) Some of the jQuery is working and some is not; the change of the file name when event mouseover and mouseout is not working, and the animation on when event mouseover and mouseout is not working either (this is the content of inlineScript.js file)

jQuery(document).ready( function() {
    jQuery( "#tabs" ).tabs().tabs({  
        fx: { opacity: 'toggle', duration: 1000 }}
    ).tabs('rotate', 3500, false);

    jQuery("ul#frontModule li a img").live('mouseover mouseout', function() {

        var fileName = jQuery(this).attr('src').search("-active");

        if (event.type == 'mouseover' && fileName == -1 ) {
            jQuery(this).attr("src", jQuery(this).attr("src")
                .replace(".png","-active.png"));
        }
        else {
            jQuery(this).attr("src", jQuery(this).attr("src")
                .replace("-active.png",".png"));
        }
    });

    /* LOGO anitmated text*/

    jQuery( "#logo" ).airport(
        [ 'small business web design', 
            'online marketing', 
            'search engine optimization', 
            'websonalized-com']
    );

    //menu animation

    jQuery('#rightBody .menu li a').live('mouseover mouseout', function(){

        if ( event.type == 'mouseover' ) 
            jQuery(this).animate({ marginLeft: "15px" }, 500 );
        else 
            jQuery(this).animate({marginLeft: "0" }, 500 );
    });

    //css for IE css3pie.com
    if (window.PIE) {

        //jQuery('.rounded').each(function() {
            //PIE.attach(this);
        //});

        jQuery('.roundRightEI').each(function() {
            PIE.attach(this);
        });

    }//end IE scripts
});

What changes do I need to make to make for this script to work in Firefox 4

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

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

发布评论

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

评论(2

剑心龙吟 2024-11-21 13:49:04

尝试按以下方式包含您的脚本,看看是否有任何区别。

document.write(unescape("%3Cscript src='path/js/inlineScript.js' type='text/javascript'%3E%3C/script%3E"));

有时,脚本中的引号可能会干扰负责加载的声明中包含的引号。

Try including your script in the following way and see if that makes any difference.

document.write(unescape("%3Cscript src='path/js/inlineScript.js' type='text/javascript'%3E%3C/script%3E"));

Sometimes quotes within your scripts may interfere with quotes included in the declaration responsible for the loading.

绻影浮沉 2024-11-21 13:49:04

实际上,我需要做的就是在从事件调用回调时添加“事件”一词。

旧代码:

 jQuery('#rightBody .menu li a').live('mouseover mouseout', function(){

        if ( event.type == 'mouseover' ) 
            jQuery(this).animate({ marginLeft: "15px" }, 500 );
        else 
            jQuery(this).animate({marginLeft: "0" }, 500 );
    });

新代码:

 jQuery('#rightBody .menu li a').live('mouseover mouseout', function(event){

        if ( event.type == 'mouseover' ) 
            jQuery(this).animate({ marginLeft: "15px" }, 500 );
        else 
            jQuery(this).animate({marginLeft: "0" }, 500 );
    });

与 HTML5 和严格标准有关的内容

Actually all I needed to do was to add the word "event" when calling the callback from the event.

Old code:

 jQuery('#rightBody .menu li a').live('mouseover mouseout', function(){

        if ( event.type == 'mouseover' ) 
            jQuery(this).animate({ marginLeft: "15px" }, 500 );
        else 
            jQuery(this).animate({marginLeft: "0" }, 500 );
    });

New code:

 jQuery('#rightBody .menu li a').live('mouseover mouseout', function(event){

        if ( event.type == 'mouseover' ) 
            jQuery(this).animate({ marginLeft: "15px" }, 500 );
        else 
            jQuery(this).animate({marginLeft: "0" }, 500 );
    });

Something having to do with HTML5 and strict standards

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