linuxfreakphp Posted December 22, 2013 Share Posted December 22, 2013 (edited) hey guys, i got a problem with Jquery. i have this code: $(document).ready(function () { var color = $('#title_buttom').css('background-color'); $('.title_all').on('mouseover',function () { var styles = { backgroundColor: '#FF0C55' }; $('#title_buttom').css(styles); }); $('.title_all').on('mouseout',function () { $('#title_buttom').css('background-color', color); }); }); explain what the code is doing: when the mouse is over class ".title_all" the id "#title_buttom" is exchange the exist background-color and when the mouse is mouseout the original color is exchange to the background-color of the id "#title_buttom" back. It is part of a new interface i'm building as some could guess. as you all see it is should work, but on my pc's linux operating systems suse and gentoo with the browsers firefox and chrome this code didn't working, but on the browser opera his working great. i ask some friends to run it and on their pc's linux and windows operating systems the firefox and chrome accept my code without any problem and it work's. what is the problem? i deleted all the history and close the and opened the browsers, but the code is still not working on my firefox and chrome. the code you see here on my server is more effective and advanced, but the problem stay the same as in this old version of my code you can see in this post. here is the html code, css code and the js code. <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" href="./style/style.css" /> <script src="./javascript/jquery-1.10.2.min.js"></script> <script type="text/javascript"> $(document).ready(function () { var color = $('#title_buttom').css('background-color'); $('.title_all').on('mouseover',function () { var styles = { backgroundColor: '#FF0C55' }; $('#title_buttom').css(styles); }); $('.title_all').on('mouseout',function () { $('#title_buttom').css('background-color', color); }); }); </head> <body> <div id='all_div'> <div id='master'> <div id='title_top'> <div id='title_home' class='title_all'>Home</div> <div id='title_info' class='title_all'>Info</div> <div id='title_project' class='title_all'>Projects</div> <div id='title_contectus' class='title_all'>Contect us</div> </div> <div id='title_buttom'></div> </div> </div> </body> </html> css code: #all_div { width:1250px; height:800px; background-color:#0C39FF; } #master { top:5px; width:80%; position:relative; left:10%; } #title_home, #title_info, #title_project, #title_contectus, #title_buttom { background-color:#26FF1E; } #title_home,#title_info,#title_project,#title_contectus { border-top-left-radius: 15px; border-top-right-radius: 15px; display:inline-block; font-size:40px; text-align:center; } #title_home:hover, #title_info:hover, #title_project:hover ,#title_contectus:hover { background-color:#FF1145; } #title_home, #title_info, #title_project { width:235px; } #title_contectus { width:280px; } #title_buttom { height:20px; border-bottom-right-radius: 20px; border-bottom-left-radius: 20px; } Edited December 22, 2013 by linuxfreakphp Quote Link to comment https://forums.phpfreaks.com/topic/284892-jquery-code-works-under-opera-only-and-not-under-firefox-and-chrome/ Share on other sites More sharing options...
Ch0cu3r Posted December 22, 2013 Share Posted December 22, 2013 Runs fine for me. Link for anyone to test http://jsfiddle.net/WFsYL/ Maybe a stupid question but have you checked that you have javascript enabled on firefox and chrome? Also does the browser's (developer/javascript) console show any errors? Quote Link to comment https://forums.phpfreaks.com/topic/284892-jquery-code-works-under-opera-only-and-not-under-firefox-and-chrome/#findComment-1462944 Share on other sites More sharing options...
linuxfreakphp Posted December 23, 2013 Author Share Posted December 23, 2013 (edited) Runs fine for me. Link for anyone to test http://jsfiddle.net/WFsYL/ Maybe a stupid question but have you checked that you have javascript enabled on firefox and chrome? Also does the browser's (developer/javascript) console show any errors? i don't know what to say man because the link you post with my code, allow me to see the code active and it is working with the firefox and chrome, but on my server (real site with dns c-panel) and my local host 127.0.0.1 with the same chrome and firefox it is not working. i have other codes and samples that using js and i have no problem with those codes and the browsers: firefox and chrome do allow javascript to run. what else can i checked if i can see that your link with my code is woking fine in the firefox and chrome? Edited December 23, 2013 by linuxfreakphp Quote Link to comment https://forums.phpfreaks.com/topic/284892-jquery-code-works-under-opera-only-and-not-under-firefox-and-chrome/#findComment-1463022 Share on other sites More sharing options...
linuxfreakphp Posted December 23, 2013 Author Share Posted December 23, 2013 (edited) here is the error log using firefox: [23:08:37.433] ------ http://127.0.0.1/***/********/****/index.xhtml [23:08:37.512] GET http://127.0.0.1/***/********/****/index.xhtml [HTTP/1.1 304 Not Modified 0ms] [23:08:37.653] GET http://127.0.0.1/***/********/****/style/style.css [HTTP/1.1 304 Not Modified 0ms] [23:08:37.654] GET http://127.0.0.1/***/********/****/javascript/index.js [HTTP/1.1 304 Not Modified 0ms] [23:08:37.572] SyntaxError: in strict mode code, functions may be declared only at top level or immediately within another function @ http://127.0.0.1/***/********/****/javascript/index.js:5 [23:08:37.655] GET http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js [HTTP/1.1 304 Not Modified 0ms] [23:08:37.593] SyntaxError: Using //@ to indicate source map URL pragmas is deprecated. Use //# instead @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:1 [23:08:37.593] TypeError: anonymous function does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:4 [23:08:37.594] TypeError: function o does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:4 [23:08:37.594] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:4 [23:08:37.594] TypeError: anonymous function does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:4 [23:08:37.594] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:4 [23:08:37.595] TypeError: anonymous function does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:4 [23:08:37.595] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:4 [23:08:37.595] TypeError: anonymous function does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:4 [23:08:37.595] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:4 [23:08:37.595] TypeError: anonymous function does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:4 [23:08:37.595] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:4 [23:08:37.595] TypeError: function R does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:5 [23:08:37.596] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:5 [23:08:37.596] TypeError: anonymous function does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:5 [23:08:37.596] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:5 [23:08:37.596] TypeError: anonymous function does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:5 [23:08:37.596] TypeError: function at does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:5 [23:08:37.596] TypeError: anonymous function does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:5 [23:08:37.597] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:5 [23:08:37.597] TypeError: anonymous function does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:6 [23:08:37.598] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:6 [23:08:37.598] TypeError: anonymous function does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:6 [23:08:37.598] TypeError: function In does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:6 [23:08:37.598] TypeError: function zn does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:6 [23:08:37.598] TypeError: anonymous function does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:6 [23:08:37.598] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:6 [23:08:37.598] TypeError: function Zn does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:6 [23:08:37.598] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:6 [23:08:37.599] TypeError: anonymous function does not always return a value @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:6 [23:08:37.606] ReferenceError: reference to undefined property d.attributes[c].expando @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:4 [23:08:37.606] ReferenceError: reference to undefined property e.selector @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:4 [23:08:37.638] SyntaxError: illegal character @ http://127.0.0.1/***/********/****/index.xhtml:33 [23:08:37.719] Unknown property 'box-sizing'. Declaration dropped. @ http://127.0.0.1/***/********/****/index.xhtml [23:08:37.720] ReferenceError: reference to undefined property x.event.triggered @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:5 [23:08:37.720] ReferenceError: reference to undefined property x.cache[e[x.expando]] @ http://127.0.0.1/***/********/****/javascript/jquery-1.10.2.min.js:5 can anyone now help me find the problem? chrome log: Uncaught SyntaxError: Unexpected token ILLEGAL index.xhtml:71 but i have only 57 lines in my xhtml file. I'm adding the last version of the code i have. index.js: /* */ /* */ try { function jquery1() { var color = $('#title_buttom').css('background-color'); $('.title_all').on('mouseover',function () { var styles = { backgroundColor: 'red' }; $('#title_buttom').css(styles); }); $('.title_all').on('mouseout',function () { $('#title_buttom').css('background-color', color); }); } } catch(err) { txt="There was an error on this page.\n\n"; txt+="Error description: " + err.message + "\n\n"; txt+="Click OK to continue.\n\n"; alert(txt); } xhtml file: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title></title> <link rel="stylesheet" href="./style/style.css" /> <script src="./javascript/index.js"></script> <script src="./javascript/jquery-1.10.2.min.js"></script> <!--<script src="./javascript/jquery.slides.min.js"></script>--> <!--<script src="./javascript/jquery.easing.1.2.js"></script>--> <!--<script type="text/javascript" src="./javascript/movingpicsandmovies.js"></script>--> <!--<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>--> <!--<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>--> <!--<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'></script>--> <!--<script src="http://code.jquery.com/jquery-1.9.1.js"></script>--> <!--<script src="http://code.jquery.com/jquery-migrate-1.1.0.js"></script>--> <script type="text/javascript"> try { $(document).ready(function () { jquery1(); }); } catch(err) { txt="There was an error on this page.\n\n"; txt+="Error description: " + err.message + "\n\n"; txt+="Click OK to continue.\n\n"; alert(txt); } </script> </head> <body> <div id='all_divs'> <div id='master'> <div id='top'></div> <div id='title_top'> <div id='**********'> <div id='new'>***</div> <div id='models'>*********</div> </div> <div id='title_op' class='title_all'>Contect us</div> <div id='title_op' class='title_all'>Projects</div> <div id='title_op' class='title_all'>Info</div> <div id='title_op' class='title_all'>Home</div> </div> <div id='title_buttom'></div> <div id='slideshow'> </div> </div> </div> </body> </html> or just the xhtml with js in the same file: (still not working with firefox and chrome.) <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Language" content="he" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title></title> <link rel="stylesheet" href="./style/style.css" /> <!--<script src="./javascript/index.js"></script>--> <script src="./javascript/jquery-1.10.2.min.js"></script> <!--<script src="./javascript/jquery.slides.min.js"></script>--> <!--<script src="./javascript/jquery.easing.1.2.js"></script>--> <!--<script type="text/javascript" src="./javascript/movingpicsandmovies.js"></script>--> <!--<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>--> <!--<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>--> <!--<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'></script>--> <!--<script src="http://code.jquery.com/jquery-1.9.1.js"></script>--> <!--<script src="http://code.jquery.com/jquery-migrate-1.1.0.js"></script>--> <script type="text/javascript"> try { $(document).ready(function () { //jquery1(); var color = $('#title_buttom').css('background-color'); $('.title_all').on('mouseover',function () { var styles = { backgroundColor: 'red' }; $('#title_buttom').css(styles); }); $('.title_all').on('mouseout',function () { $('#title_buttom').css('background-color', color); }); }); } catch(err) { txt="There was an error on this page.\n\n"; txt+="Error description: " + err.message + "\n\n"; txt+="Click OK to continue.\n\n"; alert(txt); } </script> </head> <body> <div id='all_divs'> <div id='master'> <div id='top'></div> <div id='title_top'> <div id='***********'> <div id='new'>***</div> <div id='models'>***********</div> </div> <div id='title_op' class='title_all'>Contect us</div> <div id='title_op' class='title_all'>Projects</div> <div id='title_op' class='title_all'>Info</div> <div id='title_op' class='title_all'>Home</div> </div> <div id='title_buttom'></div> <div id='slideshow'> </div> </div> </div> </body> </html> Edited December 23, 2013 by linuxfreakphp Quote Link to comment https://forums.phpfreaks.com/topic/284892-jquery-code-works-under-opera-only-and-not-under-firefox-and-chrome/#findComment-1463029 Share on other sites More sharing options...
jazzman1 Posted December 24, 2013 Share Posted December 24, 2013 (edited) Did you get these errors when are you using try{}catch{} block or not only? Try to rid $( document ).ready() of the try{} block. My IDE and firebug say that there is a syntax error. Try to catch <script type="text/javascript"> $(document).ready(function() { try { var color = $('#title_buttom').css('background-color'); $('.title_all').on('mouseover', function() { var styles = { backgroundColor: '#FF0C55' }; $('#title_buttom').css(styles); }); $('.title_all').on('mouseout', function() { $('#title_buttom').css('background-color', color); }); } catch (err) { txt="There was an error on this page.\n\n"; txt+="Error description: " + err.message + "\n\n"; txt+="Click OK to continue.\n\n"; alert(txt); } }); </script> Edited December 24, 2013 by jazzman1 Quote Link to comment https://forums.phpfreaks.com/topic/284892-jquery-code-works-under-opera-only-and-not-under-firefox-and-chrome/#findComment-1463037 Share on other sites More sharing options...
linuxfreakphp Posted December 24, 2013 Author Share Posted December 24, 2013 (edited) Did you get these errors when are you using try{}catch{} block or not only? Try to rid $( document ).ready() of the try{} block. My IDE and firebug say that there is a syntax error. Try to catch <script type="text/javascript"> $(document).ready(function() { try { var color = $('#title_buttom').css('background-color'); $('.title_all').on('mouseover', function() { var styles = { backgroundColor: '#FF0C55' }; $('#title_buttom').css(styles); }); $('.title_all').on('mouseout', function() { $('#title_buttom').css('background-color', color); }); } catch (err) { txt="There was an error on this page.\n\n"; txt+="Error description: " + err.message + "\n\n"; txt+="Click OK to continue.\n\n"; alert(txt); } }); </script> your code don't show what wrong with syntax. the chrome with your code is telling me the same thing Uncaught SyntaxError: Unexpected token ILLEGAL index.xhtml:116 but i have only 79 lines of codes only. the firefox with your code is telling me the same thing as before. [17:28:02.967] SyntaxError: in strict mode code, functions may be declared only at top level or immediately within another function @ http://127.0.0.1/bla/temp39/ver6/javascript/index.js:3 [17:28:03.252] SyntaxError: Using //@ to indicate source map URL pragmas is deprecated. Use //# instead @ http://code.jquery.com/jquery-1.9.1.min.js:1 [17:28:03.252] TypeError: anonymous function does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:3 [17:28:03.252] TypeError: function a does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:3 [17:28:03.253] TypeError: function P does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:3 [17:28:03.253] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://code.jquery.com/jquery-1.9.1.min.js:3 [17:28:03.253] TypeError: anonymous function does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:3 [17:28:03.253] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://code.jquery.com/jquery-1.9.1.min.js:3 [17:28:03.253] TypeError: anonymous function does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:3 [17:28:03.254] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://code.jquery.com/jquery-1.9.1.min.js:4 [17:28:03.254] TypeError: anonymous function does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:4 [17:28:03.254] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://code.jquery.com/jquery-1.9.1.min.js:4 [17:28:03.255] TypeError: anonymous function does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:4 [17:28:03.255] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://code.jquery.com/jquery-1.9.1.min.js:4 [17:28:03.255] TypeError: anonymous function does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:4 [17:28:03.255] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://code.jquery.com/jquery-1.9.1.min.js:4 [17:28:03.255] TypeError: anonymous function does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:4 [17:28:03.255] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://code.jquery.com/jquery-1.9.1.min.js:4 [17:28:03.256] TypeError: anonymous function does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:4 [17:28:03.257] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://code.jquery.com/jquery-1.9.1.min.js:5 [17:28:03.257] TypeError: anonymous function does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:5 [17:28:03.258] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://code.jquery.com/jquery-1.9.1.min.js:5 [17:28:03.258] TypeError: anonymous function does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:5 [17:28:03.258] TypeError: function In does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:5 [17:28:03.258] TypeError: function zn does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:5 [17:28:03.258] TypeError: anonymous function does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:5 [17:28:03.258] SyntaxError: test for equality (==) mistyped as assignment (=)? @ http://code.jquery.com/jquery-1.9.1.min.js:5 [17:28:03.259] TypeError: anonymous function does not always return a value @ http://code.jquery.com/jquery-1.9.1.min.js:5 [17:28:03.265] ReferenceError: reference to undefined property d.attributes[c].expando @ http://code.jquery.com/jquery-1.9.1.min.js:3 [17:28:03.265] ReferenceError: reference to undefined property b.valHooks[this] @ http://code.jquery.com/jquery-1.9.1.min.js:3 [17:28:03.270] SyntaxError: illegal character @ http://127.0.0.1/*********/index.xhtml:55 [17:28:03.304] Unknown property 'box-sizing'. Declaration dropped. @ http://127.0.0.1/*********/index.xhtml [17:28:03.305] ReferenceError: reference to undefined property b.event.triggered @ http://code.jquery.com/jquery-1.9.1.min.js:3 [17:28:03.306] ReferenceError: reference to undefined property b.cache[e[b.expando]] @ http://code.jquery.com/jquery-1.9.1.min.js:3 [17:28:59.882] Ignoring get or set of property that has [LenientThis] because the "this" object is incorrect. @ chrome://firebug/content/chrome/reps.js:476 [17:29:41.917] The Web Console logging API (console.log, console.info, console.warn, console.error) has been disabled by a script on this page. and again the opera has no problem at all and the your code and my code are working on the opera great. Edited December 24, 2013 by linuxfreakphp Quote Link to comment https://forums.phpfreaks.com/topic/284892-jquery-code-works-under-opera-only-and-not-under-firefox-and-chrome/#findComment-1463050 Share on other sites More sharing options...
jazzman1 Posted December 24, 2013 Share Posted December 24, 2013 How many versions of jquery libraries do you try to include in the same document? Disable entire cache in firefox and chrome! The syntax of my code is correct yours is wrong using try{}catch{} block. Quote Link to comment https://forums.phpfreaks.com/topic/284892-jquery-code-works-under-opera-only-and-not-under-firefox-and-chrome/#findComment-1463053 Share on other sites More sharing options...
linuxfreakphp Posted December 24, 2013 Author Share Posted December 24, 2013 (edited) sorry now i see where is my mistake now and i set it in my code, thanks jazzman1. now the firefox and chrome is working with that and also the opera, but i want to know please why did the opera worked and firefox and chrome not with my mistake? can you tell me why please? html code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" href="./style/style.css" /> <script src="./javascript/index.js"></script> <script src="./javascript/jquery-1.10.2.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ try { jquery1(); } catch (err) { error_function(err); } }); </script> </head> <body> <div id='all_divs'> <div id='master'> <div id='top'></div> <div id='title_top'> <div id='********'> <div id='***'>***</div> <div id='******'>******</div> </div> <div id='title_op' class='title_all'>Contect us</div> <div id='title_op' class='title_all'>Projects</div> <div id='title_op' class='title_all'>Info</div> <div id='title_op' class='title_all'>Home</div> </div> <div id='title_buttom'></div> <div id='slideshow'> </div> </div> </div> </body> </html> index.js try { function jquery1() { try { var color = $('#title_buttom').css('background-color'); $('.title_all').on('mouseover',function () { var styles = { backgroundColor: 'red' }; $('#title_buttom').css(styles); }); $('.title_all').on('mouseout',function () { $('#title_buttom').css('background-color', color); }); } catch(err) { error_function(err); } } function error_function(err) { txt="There was an error on this page.\n\n"; txt+="Error description: " + err.message + "\n\n"; txt+="Click OK to continue.\n\n"; alert(txt); } } catch(err) { error_function(err); } Edited December 24, 2013 by linuxfreakphp Quote Link to comment https://forums.phpfreaks.com/topic/284892-jquery-code-works-under-opera-only-and-not-under-firefox-and-chrome/#findComment-1463056 Share on other sites More sharing options...
jazzman1 Posted December 24, 2013 Share Posted December 24, 2013 The wrong script, It does not work in Opera for me, the current version using is: Version 12.16Build 1860Platform LinuxSystem x86_64, 2.6.32-431.el6.centos.plus.x86_64 I don't have any idea why the wrong script is worked for you. Quote Link to comment https://forums.phpfreaks.com/topic/284892-jquery-code-works-under-opera-only-and-not-under-firefox-and-chrome/#findComment-1463060 Share on other sites More sharing options...
linuxfreakphp Posted December 24, 2013 Author Share Posted December 24, 2013 (edited) The wrong script, It does not work in Opera for me, the current version using is: I don't have any idea why the wrong script is worked for you. i didn't said it work for me in firefox or chrome, but i said the opera different browser allow the code run and work and i asked why about the opera. because the opera accept it in four pc's when the firefox and the chrome didn't accept the code on this pc's. linux and windows the result was the same. Edited December 24, 2013 by linuxfreakphp Quote Link to comment https://forums.phpfreaks.com/topic/284892-jquery-code-works-under-opera-only-and-not-under-firefox-and-chrome/#findComment-1463067 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.