开发者

jQuery inline script not working in Firefox 4

开发者 https://www.devze.com 2023-03-11 19:43 出处:网络
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

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


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消