JavaScript - Script Not Working In Opera
Ok, I've determined that my problem wasn't in the script itself, but in the fact that Opera 10 Beta 2 apparently does not recognize the "onload" attribute of the body tag. Is there a way to work around this?
Similar TutorialsOk, here's the page as it is right now: http://www.crackin.com/dev/index.php The paganation for the top 3 images is Sweet Pages: http://tutorialzine.com/2010/05/swee...tion-solution/ The content loading below is a page-replace script I got he http://css-tricks.com/dynamic-page-replacing-content/ And I'm also trying to integrate shadowbox (or lightbox, whichever will work) into the lower set of images. I have 2 problems right now I can't figure out, and I'm sure it somehow has to do with the fact I'm trying to mash 3 different JS addons into a single page, I'm still pretty new to this whole JS thing... First problem I'm having is that IE7 and Opera don't like the links in the upper images. Clicking a gallery image does not load the associated page below from those 2 browsers, however IE8 and FF seem to work fine. Second problem is getting shadowbox/lightbox to work on those lower images. I tried a couple different things but main thing I did is make sure the script is actually working by setting the header text to a link with shadowbox attached and that worked. That same link doesn't work when applied to the lower images (loads image in new window). Lightbox does the same thing. Thanks for any help. Hi, I've made a web based tool that times how long a web page takes to load in an iframe and today I redesigned it but now it has issues. When I load it in Chrome and Opera the new version works fine but in FF 3.6 and IE 8 only the footer area is displayed. I have added the links below - You'll be able to access the code via your browser's "View page Source" option. URLs: New test (With problem): http://browserspeedtest.camerongray....net/version31/ Old test (Works perfectly): http://browserspeedtest.co.cc Any help is greatly appreciated! Cameron Gray I'm using a nice little script which replaces the usual file upload input with whatever image you want and then with JS makes sure that an invisible 'browse' button is underneath the mouse pointer whenever the mouse is moved over the image you want to use. Nice It works on every browser ie7 ie8 ie9 FF safari chrome but not on opera. On Opera the regular file input appears. I've had a good hoke round the 'net and I know there's loads of scripts which do similar things. But either they are too complicated for me to figure out how to use them eg uploadify (bit of a newbie) or they do similar things but just not as well - like making the custom image the same size as the file input would be (there's issues with that too). here's the script I'm using - there's not much to it How come it doesn't work in Opera grrrr... Is there anyway to fix it? This is perfect for what I want apart from not working in Opera We have an ASP website which everything works fine in pre-IE8, firefox and even our iPhone browsers but not IE8. I know what the problem is and where the problem is but don't know how to fix it, it should be pretty simple but I am not a developer...just trying to fix this one problem When the page loads it is supposed to automatically fill in a text box with the word: No This is the javascript that is supposed to do that: Code: <script type="text/javascript"> function statusdefault(oSel) { status = 'No'; document.getElementById('theLabel5').value = status; } </script> and this shows the onload line: Code: <body onload="statusdefault(this)" bgcolor="#FFFFFF" background="images/background_stripe.jpg" text="#000000" link="#CCCCCC" vlink="#CCCCCC" alink="#CCCCCC" leftmargin="0" topmargin="10" marginwidth="0" marginheight="10"> <form action="<%=MM_editAction%>" method="POST" name="frmDetail" id="frmDetail"> additionally when someone changes a selection in one of the comboboxes it should change the textbox to: Yes Here is the code for that (which also does not work): Code: <script type="text/javascript"> function statusupdated(oSel) { status = 'Yes'; document.getElementById('theLabel5').value = status; } </script> which of course gets triggered by this: Code: <select name="lstQueue" id="select" onChange="statusupdated(this)"> This is the code for the said textbox: Code: <input name="txtStatusUpdated" type="text" id="theLabel5" value="<%=(rsQ.Fields.Item("StatusUpdated").Value)%>"> The error I get in IE8 is "This page cannot be displayed..." and give a http500 error with no other info. It looks like this javascript code was copied and pasted throughout this same ASP page and altered to do different things. All of the other scripts like this one work fine so I know it is just something in these particular ones that have a problem. Thanks for any help that can be given!!! Scott Hey, I'm a total noob when it comes to javascript. and manged to make this code for a different forum: Code: //This script was created by TROPAFLIGHT2 var d=new Date(); var theDay=d.getDay(); switch (theDay) { case 1: document.write("<EMBED src="http://bit.ly/Ky9R5F" autostart=true loop=true volume=100 hidden=true>"); break; case 2: document.write("<EMBED src="http://bit.ly/Ky9R5F" autostart=true loop=true volume=100 hidden=true>"); break; case 3: document.write("<EMBED src="http://bit.ly/JGUdU9" autostart=true loop=true volume=100 hidden=true>"); break; case 4: document.write("<EMBED src="http://bit.ly/JMVvl0" autostart=true loop=true volume=100 hidden=true>"); break; case 5: document.write("<EMBED src="http://bit.ly/JVq7yb" autostart=true loop=true volume=100 hidden=true>"); break; case 6: document.write("<EMBED src="http://bit.ly/J7fvwY" autostart=true loop=true volume=100 hidden=true>"); break; default: document.write("<EMBED src="http://bit.ly/J2mc7a" autostart=true loop=true volume=100 hidden=true>"); } That code obviously didn't work so I manged to fix certain things: Code: //This script was created by TROPAFLIGHT2 var d=new Date(); var theDay=d.getDay(); switch (theDay) { case 1: document.write;"(<EMBED src="//bit.ly/Ky9R5F" autostart=true loop=true volume=100 hidden=true>)"; break; case 2: document.write;"(<EMBED src="//bit.ly/Ky9R5F" autostart=true loop=true volume=100 hidden=true>)"; break; case 3: document.write;"(<EMBED src="//bit.ly/JGUdU9" autostart=true loop=true volume=100 hidden=true>)"; break; case 4: document.write;"(<EMBED src="//bit.ly/JMVvl0" autostart=true loop=true volume=100 hidden=true>)"; break; case 5: document.write;"(<EMBED src="//bit.ly/JVq7yb" autostart=true loop=true volume=100 hidden=true>)"; break; case 6: document.write;"(<EMBED src="//bit.ly/J7fvwY" autostart=true loop=true volume=100 hidden=true>)"; break; default: document.write;"(<EMBED src="//bit.ly/J2mc7a" autostart=true loop=true volume=100 hidden=true>)"; } Problem is, it still doesn't work and I don't really know why. I've stared at it for a long time but the problem didn't click like last time. Any help at all would be appreciated. Thanks in advance, me. Hi all, thanks in advance for any help. For a lot of years now I've used a javascript that does a simple rollover image swap, but also changes another alternate image at the same time. It's always worked like a charm. Lately I realized that the script no longer works in IE, though it used to in older versions of IE (I think it stopped working in anything past IE 7). It still works fine in Firefox, Safari, etc. I haven't been able to find a good alternative for this script, so I'm really trying to get it to work again in IE, but so far no luck. Here's the link to the actual script itself. http://www.jsmadeeasy.com/javascript...nges/index.htm (you can see that even the example on this page doesn't work in IE anymore) You can also see it in action at this site: http://www.augustroad.com/ (notice when you roll over the menu bar an alternate image appears in FF, but not in IE). Again, thanks in advance for any help. I truly appreciate it! Jordan Hello, Im new to scripting. I have 2 scripts that work in firefox but not in ie. I was wondering if anyone could help me? The First Javascript Code: <SCRIPT language="javascript"> <!-- // ***** GET TOTAL function CalculateSum(setup, month, plan, form) { var A = parseFloat(setup); var B = parseFloat(month); form.x_amount.value = A + B; form.user5.value = plan; } --> </SCRIPT> The second javascript Code: var os_price = 0; var base_price = 0000; var total_carryover = 0000; function show_price() { features = 0; for(var pr in price) { features+=price[pr]; } month = features + base_price + os_price ; total = month + total_carryover; document.getElementById('setup_price').innerHTML="$"+(setup)/100; document.getElementById('monthly_price').innerHTML="$"+(month)/100; document.getElementById('total_price').innerHTML="$"+((total)/100+setup/100); } Thanks in advance for any help. I'm helping out my friend complete her site. check it out he http://themodline.com/clients/jcevent when you head over to the portfolio section the the lightbox script doesnt work properly. but if you just go to http://themodline.com/clients/jcevent/portfolio.html -it works fine. are the scripts mixing up? i made sure i got the correct codes. i made sure the script files are correctly linked. check out my scripts. they are zipped he http://www.themodline.com/clients/jcevent/scripts.zip thanks for the help guys. hope this makes sense! Nice for a change: a piece of code that does work in all versions of IE, but not in Firefox. I'm stuck. Code: <img alt="Loodgieters" title="Loodgieters" src="/core/loodgieters_uit.png" name="loodgieters" border="0" style="margin-right:1px; margin-top:1px; float:left; cursor:pointer;" onclick="document.location='/pages/loodgieters.php';" onmouseover="foto1.style.backgroundColor='#392d63'; loodgieters.src='/core/loodgieters_aan.png'" onmouseout ="foto1.style.backgroundColor='#008ac9'; loodgieters.src='/core/loodgieters_uit.png'" /> Explanation: element "loodgieters" is a menu button that should change on mouseover. It doesn't in FF, it does in IE. Secondly, when you "mousover" the image, it should change the backgroundcolor of a second element (foto1). Element 'foto1' is a table cell. In return, when you mouse-over this table cell, the image element 'loodgieters' should change as well. So it's a two-way thing. The code for the table cell is: Code: <td height="189" id="foto1" bgcolor="#008ac9" valign="top" onmouseover="style.backgroundColor='#392d63'; loodgieters.src='/core/loodgieters_aan.png';" onmouseout="style.backgroundColor='#008ac9'; loodgieters.src='/core/loodgieters_uit.png';" style="cursor:pointer;" onclick="document.location='/pages/loodgieters.php';"> <img alt="Loodgieters" title="Loodgieters" src="/core/loodgieters.png" style="border:0; margin-left:auto; margin-right:auto; margin-top:10px; display: block;" /></td> Again: it all works as I expected in IE, Safari and Chrome, but it does not in Firefox. The whole page validates as XHTML 1.0 Transitional What am I overlooking here? I'm stuck. Any help is welcome i have a script that measures the window size and - at this point - only adjusts the width of one css element. first function: Quote: var myWidth = 0, myHeight = 0; function getWindowSize() { if( typeof( window.innerWidth ) == 'number' ) { //Non-IE myWidth = window.innerWidth; myHeight = window.innerHeight; } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) { //IE 6+ in 'standards compliant mode' myWidth = document.documentElement.clientWidth; myHeight = document.documentElement.clientHeight; } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { //IE 4 compatible myWidth = document.body.clientWidth; myHeight = document.body.clientHeight; } // window.alert( 'Width = ' + myWidth ); // window.alert( 'Height = ' + myHeight ); } second function: Quote: //changecss JavaScript Functions by Shawn Olson //Copyright 2006-2008 //http://www.shawnolson.net function changecss(theClass,element,value,sheet) { //Last Updated on October 10, 1020 //documentation for this script at //http://www.shawnolson.net/a/503/altering-css-class-attributes-with-javascript.html //ms: 5.5.11 added sheet: you have to point at the stylesheet by number var cssRules; var added = false; var mySheet = document.styleSheets[sheet]; if (mySheet['rules']) { cssRules = 'rules'; } else if (mySheet['cssRules']) { cssRules = 'cssRules'; } else { //no rules found... browser unknown } for (var R = 0; R < mySheet[cssRules].length; R++) { if (mySheet[cssRules][R].selectorText == theClass) { if(mySheet[cssRules][R].style[element]){ mySheet[cssRules][R].style[element] = value; added=true; break; } } } if(!added){ try{ mySheet.insertRule(theClass+' { '+element+': '+value+'; }',mySheet[cssRules].length); } catch(err){ try{mySheet.addRule(theClass,element+': '+value+';');}catch(err){} } } } i call the function in a php script that is to rule out that the server is talking to a mobile device, however, it echos javascript and a document ready function: Quote: $useragent=$_SERVER['HTTP_USER_AGENT']; if(preg_match('/android|...(non relevant code)...|zte\-/i',substr($useragent,0,4))) { echo '<link rel="stylesheet" type="text/css" href="1" />'; //the above never happens as i am testing on big screen } else { //echo '<link id="screensize" rel="stylesheet" type="text/css" href="stylesheet.php?cssid=47&mediatype=screen" />'; echo '<script type="text/javascript">'; echo '$(document).ready(function() { getWindowSize(); //ms: these variables come back: myWidth, myHeight if (myWidth >=1225) { changecss(".core-pageWidth","width","1225px",1); } else if (myWidth >1000) { myWidth=myWidth - 20; changecss(".core-pageWidth","width",myWidth+"px",1); } else if (myWidth >910) { myWidth=myWidth - 20; changecss(".core-pageWidth","width",myWidth+"px",1); } }); </script>'; } the changecss() does not work in https but works fine in http. is this to be expected? mario Hi there, i have this simple script that replaces the scrollbar of an iframe called iFrame1 with 2 up and down arrow images, but it only works in IE, i've tried it in Chrome and Firefox... here is the code Code: <script type="text/javascript" language="javascript"> function bsh_iFrame1(step,time){hs_iFrame1=setInterval("sh_iFrame1("+step+")",time)} function esh_iFrame1(){clearInterval(hs_iFrame1)} function sh_iFrame1(step) { scrollx=iFrame1.document.body.scrollLeft scrolly=iFrame1.document.body.scrollTop scrolly=scrolly+step iFrame1.window.scroll(scrollx,scrolly) } </script> Code: </td><td align="center" valign="middle" width="31"><img src="up.png" alt="up" border=0 vspace="5" hspace="3" onMouseDown="esh_iFrame1();bsh_iFrame1(-3,2)" onMouseUp="esh_iFrame1();bsh_iFrame1(-1,20)" onMouseOver="bsh_iFrame1(-1,20)" onMouseOut="esh_iFrame1()"><br> <img src="down.png" alt="down" border=0 vspace="5" hspace="3" onMouseDown="esh_iFrame1();bsh_iFrame1(3,2)" onMouseUp="esh_iFrame1();bsh_iFrame1(1,20)" onMouseOver="bsh_iFrame1(1,20)" onMouseOut="esh_iFrame1()"> thanks in advance for any answers... Hey: I have two javascripts on my page but one isn't showing with both codes in page. [CODE]<script type="text/javascript" src="js/image-slideshow.js"></script>[ICODE] The above code is for the image slide. When this is in the html the other one doesn't work (a text changer). The wbesite is http://www.uwics.com/constitution.htm There is no text at the top of the page currently. If you check Home you'll see how it should be. Any help would be greatly appreciated. Thank you, Mitka hi all. im having problems with this ajax script i wrote: Code: function admin_adduser() { xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Browser does not support HTTP Request"); return; } user = document.getElementById('user_user').value; user = user.replace(/^\s+|\s+$/g, '');// trim whitespace //check if name is unique unique = 'false'; var params = "?user=" + escape(user); var url="_check_username.php"; url=url+params; ajaxedInner = ""; xmlHttp.open("GET",url,true); xmlHttp.setRequestHeader("If-Modified-Since", "Fri, 31 Dec 1999 23:59:59 GMT"); xmlHttp.onreadystatechange=stateChanged; xmlHttp.send(null); xmlHttp.onreadystatechange = function() { if (xmlHttp.readyState == 4) { if (xmlHttp.status == 200) { unique = xmlHttp.responseText.replace(/^\s+|\s+$/g, ''); //trims all whitespace! //alert(unique); } } } if(unique == 'true') { //alert("working: " + unique); password = document.getElementById('user_password').value; var params = "?user_user=" + escape(user) + "&user_password=" + escape(password); var url="_admin_add_user.php"; url=url+params; ajaxedInner = "users"; xmlHttp.open("GET",url,true); xmlHttp.setRequestHeader("If-Modified-Since", "Fri, 31 Dec 1999 23:59:59 GMT"); xmlHttp.onreadystatechange=stateChanged; xmlHttp.send(null); document.getElementById('user_password').value = ""; document.getElementById('user_user').value = ""; } else { alert('Please select a unique name for the new staff member\nadd a middle initial maybe?'); } } if i alert(unique) it tells me 'true' (string) but still doesnt go into the create part of the script, i just get the alert('Please select a unique name for the new staff member\nadd a middle initial maybe?'); any ideas? i know im probably missing something basic but its really annoying lol btw - the php for the _check_username.php is simple: PHP Code: <?php if(!isset($_SESSION)) {session_start();} if($_SESSION['authorised'] != true) { exit; } include 'config.php'; include 'opendb.php'; $user = $_REQUEST['user']; $query = "SELECT user FROM user WHERE user='$user'"; echo $query; $result = mysql_query($query) or die('false'); $row = mysql_fetch_array($result, MYSQL_ASSOC); if($row) { echo 'false'; } else { echo 'true'; } mysql_free_result($result); ?> Hey ! You know I'm now trying to use that light box embed contact form in my page http://uniwebmart.com/roshan and that fade in fade out effect as well which you can see now in LCD. But when I use the java script of that embed contact form in lightbox, my previous script of fading doesn't work. <script type="text/javascript" src="scripts/prototype.js"></script> <script type="text/javascript" src="scripts/lightbox.js"></script> <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/fadeslideshow.js"></script> bold one is newly added script. Can't figure out the mistake. Can you please help me once again people??? <script type="text/JavaScript"> function refreshPage(s) { window.location.reload(); if((s.options[s.selectedIndex].value) = "zed=catcher") { alert (s.selectedIndex); //this is showing <?PHP //the next lines does not execute????? echo $form['service_code']->renderLabel(); echo $form['service_code']->renderError(); echo $form['service_code']; ?> } } </script> please help? thanks Hi there Im having an issue with some javascript that works fine in IE, but in FF is not working properly. The script is used to display a list of check boxes, the user can expand, which can checked to enabke a users selection of products. This is the script: Code: <script type="text/javascript"> var xcNode = []; // m = Parent UL ID // c = function xcSet(m, c, q, isCompletedLength) { if (document.getElementById && document.createElement) { var xs = m; m = document.getElementById(m).getElementsByTagName('ul'); var d, p, x, h, i, j; for (i = 0; i < q; i++) { var xp = document.getElementById("_" + xs + i); if (d = xp.getAttribute('id')) { if (navigator.userAgent.indexOf("Firefox") != -1) { var lstr = TrimTags((document.getElementById(xs).innerHTML)); xcCtrl(d, c, 'x', '[+] Click for more info', 'Show', 'Click to expand', lstr.length, isCompletedLength); x = xcCtrl(d, c, 'c', '[-] Click to Hide', 'Hide', 'Click to collapse', lstr.length, isCompletedLength); } else { xcCtrl(d, c, 'x', '[+] Click for more info', 'Show', 'Click to expand', (document.getElementById(xs).innerText).length, isCompletedLength); x = xcCtrl(d, c, 'c', '[-] Click to Hide', 'Hide', 'Click to collapse', (document.getElementById(xs).innerText).length, isCompletedLength); } p = xp.parentNode; if (h = !p.className) { j = 2; while ((h = !(d == arguments[j])) && (j++ < arguments.length)); if (h) { if (xp.name == parseURL()) { xp.style.display = 'block'; x = xcNode[d + 'c']; } else { xp.style.display = 'none'; x = xcNode[d + 'x']; } } } p.className = c; var expand = document.getElementById("expandBtn_" + xs + "0"); expand.insertBefore(x, expand.firstChild); } } } } works fine in IE, but not in Firefox where the expanded list is not showing the current number of items (checkboxes), it shows 34 check boxes in IE but only 17 in firefox. Thanks in advance Dear All Experts I wrote a simple code in javascript and it is working fine with IE but when I open the page in FireFox or in Google Crome it is not working as I expect. Actually I am enabling and disabling the combo box on the on change event of radio button. Please check the code attached here. And visit my site for output www.crispwerx.com/catasset Thanx to all viewer and helper Hi All, I am using one script which is functioning properly incase of IE but incase of Mozilla evenif the shift key is pressed and any character key is pressed then it is displaying Caps Lock is On. can anyone tell how can I make it Mozilla and IE compatible. I'll probably be laughed at for this attempt of coding, but all I am trying to do is read an input field, remove the "$" and write the new value in a different input field. Code: function convert_action (form){ var input1=form.input_field1.value; var clean=input1.replace(/$/, ''); form.input_field2.value = clean; } Looks simple, and thought this would work, it kindof does, it just does not strip out the dollar sign... Help would be appreciated...greatly... |