JavaScript - Javascript And Opera. How Come This Works On All Other Browsers But Opera?
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 Similar TutorialsHi, 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 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?
Hi folks, I have some complex (to me) JS code that displays time and date for the selected location from a drop-down. It can handle half hours and DST adjustments. But it only displays the results in IE. Here is where I call it in html. Code: <font color="#894DFB" size="3"><b><em><span id="wc_clock"></span></em></b></font> <br><span id="wc_date"></span> Pls help me on how to edit opera mini pls help
http://javascript.internet.com/misce...lide-show.html any ideas to get this crossfading outside IE? I have a web page which lists and displays all the characters for which a Named Entity code exists, with coding details etc.. Some of these characters are quite obscure and the reader will only be able to see them if they have a suitable Unicode font on their own PC/browser. If not, they will just see placeholder squares. For these obscure characters, I've set up a popup window. Click on a placeholder square and a small window appears which shows a .gif of what the character should look like, and a label saying what it's called. If the user closes the window after viewing, there's no problem. The difficulty comes in if somebody wants to click on a succession of placeholders and view a succession of character .gifs, and meanwhile the initial child window has slipped to the back of the stack and is behind the webpage instead of in front. In IE, Netscape and Safari, it's easy - I just use .focus to bring the child window to the fore. In Chrome, which doesn't recognise the .focus command, I close the child window and re-open it. [There's code further up the document which identifies the browser.] However, neither .focus nor closing and re-opening the window works with Opera, which turns the child window into a tab rather than a separate window, and then shoves that tab to the back. Anybody know how I can get Opera to either move the focus to the child-tab on command, or close it on command so it can be re-opened? This is the code that generates the child window: Code: function charDisplayer() { if (isIEorInnerGroup == "Yes") {codeWidth = windowWidth*.171, codeHeight = windowWidth*.239, codeInset = windowWidth*.041} else {adjust(200), codeWidth = adjust_by, adjust(280), codeHeight = adjust_by, adjust(48), codeInset = adjust_by} if (isChrome == "Yes") { if (window.generator) { window.generator.close(); window.generator= null; } } window.generator=window.open('', 'charwindow', 'height='+codeHeight+', width='+codeWidth+', left='+codeInset+', top='+codeInset*2+', scrollbars=yes'); window.generator.document.write('<html><head><title>Character sample</title>'); window.generator.document.write('<link rel="stylesheet" href="'+styleType+'">'); window.generator.document.write('</head><body>'); window.generator.document.write('<p style="text-align: center;"><div class=centred><table class=centred><tr><td style="text-align: center;"><div class=centred><img src="artwork/font_characters/'+charID+'.gif" border=3 alt="'+charName+'" align=bottom border=0 width='+charWidth+'></div>'+charName+'</td></tr></table></div>'); window.generator.document.write('<hr /><a href="javascript:self.close()">Close</a> the popup if you have finished viewing characters.</p>'); window.generator.document.write('</body></html>'); window.generator.document.close(); if (window.focus) {window.generator.focus()} } Ignore the line which begins if (isIEorInnerGroup == "Yes") - this is part of a setup which resizes all art, tables etc to maintain a constant size across all browsers and screen resolutions. "stylesheet" is passed as a variable because I have two different stylesheets on the go, to accommodate the fact that Netscape handles text-size differently from the other browsers. There's a function elsewhere which sets the value of stylesheet according to whether the browser is Netscape or not, and whether the platform is a Mac or not. "charID" is a variable which identifies the code name of the character (taken from the Named Entity code) and looks it up under that name in a list of .gifs. "charName" is a variable which passes a text-string saying what the character is called, e.g. "Not a subset of". There is an "isOpera" variable which can be used to start a specific action if the browser is Opera. I created a drawEllipse function for a Canvas library I'm making, and it works fine in Safari, Firefox, and Chrome, but in Opera, the rotation doesn't work. The function is as follows: Code: ctx.drawEllipse = function (fill, x, y, rad1, rad2, r) { ctx.save(); if (r) { ctx.translate(x, y); ctx.rotate(r); ctx.translate(-x, -y); } ctx.scale(rad1, rad2); ctx.beginPath(); ctx.arc()(x / rad1, y / rad2, 1); ctx[fill](); ctx.restore(); }; When I add rotation to the ellipse, in Opera, it doesn't rotate and just gets bigger. I have no idea why. Can anyone suggest anything? Thanks, Julian I've made a ajax chat system. Works fine all browser but opera. Opera seems to have a problem with double posting the same message over and over again. I can't seem to figure out why it's doing this. Is it a known opera bug? So the way the chat works is that you type in your message, your press enter, it then sends it to the server so that it can later be fetched by ajax to append it to the chat window. This seems to all work fine with all browser but opera. Please note that my Javascript isn't the best in the world, so any comments about the way I'm coding it and pointing out errors in my code would be awesome. Maybe someone here can explain to me why this is happening. Here is the code. Thanks for anytime spent into looking at this. Code: var refresh_rate = 1000; //Every second var idleTime = 1200000; //20 minutes var prev; function fade(obj, duration, toggle) { this.steps = 300; this.elem = document.getElementById(obj); function fadeIn() { for(var i = 0; i <= 1; i+=(1/this.steps)) { if(document.getElementById && !document.all) { setTimeout("this.elem.style.opacity = "+ i +"", i * duration); } else { setTimeout("this.elem.style.filter='alpha(opacity="+ i * 102 +"'", i * duration); } } } function fadeOut() { for(var i = 0; i <= 1; i+=(1/this.steps)) { if(document.getElementById && !document.all) { setTimeout("this.elem.style.opacity = "+ (1-i) +"", i * duration); } else { setTimeout("this.elem.style.filter='alpha(opacity="+ (1-i) * 102 +"'", i * duration); } } } /* One for Fade in and anything will be fade out*/ if(toggle == 1) { fadeIn(); } else { fadeOut(); } } function $(elem) { var obj = document.getElementById(elem); if(!obj) return; return obj; } function addEvent(elem, typ, func) { var obj = document.getElementById(elem); if(document.getElementById && !document.all) { obj.addEventListener(typ, func, false); } else if(document.all) { obj.attachEvent("on"+typ, func); } } var http = createAjax(); function createAjax() { if(!this.http && window.ActiveXObject) { try { this.http = new ActiveXObject("Msxml2.XMLHTTP" || "Microsoft.XMLHTTP"); } catch(e1) { this.http = false; } } if(!this.http && window.XMLHttpRequest) { try { this.http = new XMLHttpRequest(); } catch(e2) { alert("Sorry we was unable to make a request between your browser."); } } return this.http; } function cancelInterval() { this.canInterval = window.setTimeout("stopInterval();", idleTime); } function stopInterval() { window.clearInterval(this.refreshChat); this.refreshChat = null; this.canInterval = null; var sp = document.createElement("span"); sp.style.cssText = "color:#D83E3E; font-size:0.8em; font-style:italic;"; sp.setAttribute("id","idleMsg"); sp.innerHTML = 'Your chat has gone idle.'; $('chat-window').appendChild(sp); $('chat-window').scrollTop = $('chat-window').scrollHeight; fade('idleMsg',1000,1); } function canTimeout() { window.clearTimeout(this.canInterval); this.canInterval = null; } function startRefresh() { this.refreshChat = window.setInterval("rh()", refresh_rate); } function pressEnter(e) { if($('textbox').value.length >= 1) { if(this.canInterval) { canTimeout(); } if($('idleMsg')) { $('chat-window').removeChild(document.getElementById('idleMsg')); } var textbox = $('textbox').value; if(e.keyCode == 13) { //press enter http.open('post','scripts/php/chat.php',true); http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); http.send('textbox='+encodeURIComponent(textbox)); $('textbox').value = ''; } if(!this.refreshChat) { startRefresh(); } } } function sendText() { if(this.canInterval) { canTimeout(); } var textbox = $('textbox').value; alert(textbox); var params = 'textbox='+ encodeURIComponent(textbox); http.open('post','scripts/php/chat.php',true); http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); http.setRequestHeader('Content-length', params.length); http.setRequestHeader('Connection','close'); http.send(params); $('textbox').value = ''; if(!this.refreshChat) { startRefresh(); } } var cc = 0; var nm = 0; function rh() { if(!this.canInterval) { cancelInterval(); } var rmd = Math.random(); http.open('get','scripts/php/chat.php?s=true&rmd='+rmd, true); http.send(null); http.onreadystatechange = refresh; function refresh() { var scrollT; ($('expand').innerHTML == 'Expand +') ? scrollT = 133 : scrollT = 233; if(http.readyState == 4 && http.status == 200 && http.responseText != null && http.responseText.length >= 1 && http.responseText != prev) { if(http.responseText == prev) { alert("testing..."); } var span = document.createElement("span"); span.setAttribute("id",cc); span.innerHTML = http.responseText; $('chat-window').appendChild(span); if($('chat-window').scrollTop+36 >= $('chat-window').scrollHeight-scrollT) { $('chat-window').scrollTop = $('chat-window').scrollHeight; } prev = http.responseText; cc++; if(cc >= 70) { //Start removing old chat after 70 messages if($('wel')) { $('chat-window').removeChild(document.getElementById('wel')); } var n = cc - cc+nm; $('chat-window').removeChild(document.getElementById(n)); nm++; } } } } this.refreshChat = window.setInterval("rh()", refresh_rate); function addEvent(elem, typ, func) { var obj = document.getElementById(elem); if(document.getElementById && !document.all) { obj.addEventListener(typ, func, false); } else if(document.all) { obj.attachEvent("on"+typ, func); } } function expand() { var chatWindow = $('chat-window'); var chat = $('chat'); var spanExpand = $('expand'); if(spanExpand.innerHTML == 'Expand +') { chatWindow.style.height='230px'; chat.style.height='300px'; spanExpand.innerHTML = 'Collapse -'; $('chat-window').scrollTop = $('chat-window').scrollHeight; } else { spanExpand.innerHTML ='Expand +'; chatWindow.style.height='130px'; chat.style.height='200px'; $('chat-window').scrollTop = $('chat-window').scrollHeight; } } var i = 0; function fixTextBox(k) { var str = document.getElementById('textbox'); } function changeColor(id) { var colors = new Array(); colors[1] = '#f1f1f1'; colors[2] = '#ff593f'; colors[3] = '#A51792'; colors[4] = '#4E9258'; colors[5] = '#2B65EC'; colors[6] = '#DE954B'; colors[7] = '#36b3e1'; colors[8] = '#FD13DE'; colors[9] = '#6eb361'; var rmd = Math.random(); var params = "c="+id+"&rmd="+rmd; http.open("post","scripts/php/chat.php", true); $('color').style.backgroundColor = colors[id]; http.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); http.setRequestHeader('Content-length', params.length); http.send(params); document.getElementById('colorPicker').removeChild(document.getElementById('colorTree')); document.getElementById('colorPicker').removeChild(document.getElementById('colorBox')); $('textbox').focus(); } function popColors() { if(!$('colorTree') && !$('colorBox')) { var colorBox = document.createElement("div"); colorBox.style.cssText="background:#000000; border:2px solid #333333; width:135px; height:60px; position:absolute; left:8px; bottom:15px; opacity:0.5; filter:alpha(opacity:50); z-index:1;"; colorBox.setAttribute("id","colorBox"); var colorTree = document.createElement("div"); colorTree.setAttribute("id","colorTree"); colorTree.innerHTML = "<span style=\"background:#f1f1f1; cursor:pointer; float:left; width:15px; height:15px; margin:2px;; display:block;\" title=\"White\" onclick=\"changeColor(1)\"></span> <span style=\"background:#ff593f; cursor:pointer; float:left; width:15px; height:15px; margin:2px;; display:block;\" onclick=\"changeColor(2)\" title=\"Red\"></span> <span style=\"background:#A51792; cursor:pointer; float:left; width:15px; height:15px; margin:2px;; display:block;\" onclick=\"changeColor(3)\" title=\"Purple\"></span> <span style=\"background:#4E9258; cursor:pointer; float:left; width:15px; height:15px; margin:2px;; display:block;\" onclick=\"changeColor(4)\" title=\"Green\"></span> <span style=\"background:#2B65EC; cursor:pointer; float:left; width:15px; height:15px; margin:2px;; display:block;\" onclick=\"changeColor(5)\" title=\"Blue\"></span> <span style=\"background:#DE954B; cursor:pointer; float:left; width:15px; height:15px; margin:2px;; display:block;\" onclick=\"changeColor(6)\" title=\"Orange\"></span> <span style=\"background:#36b3e1; cursor:pointer; float:left; width:15px; height:15px; margin:2px;; display:block;\" onclick=\"changeColor(7)\" title=\"Teal\"></span> <span style=\"background:#FD13DE; cursor:pointer; float:left; width:15px; height:15px; margin:2px;; display:block;\" onclick=\"changeColor(8)\" title=\"Pink\"></span> <span style=\"background:#6eb361; cursor:pointer; float:left; width:15px; height:15px; margin:2px;; display:block;\" onclick=\"changeColor(9)\" title=\"Lime Green\"></span>"; $('colorPicker').appendChild(colorTree); $('colorPicker').appendChild(colorBox); } else { document.getElementById('colorPicker').removeChild(document.getElementById('colorTree')); document.getElementById('colorPicker').removeChild(document.getElementById('colorBox')); $('textbox').focus(); } } function popColorsClose() { if($('colorTree') && $('colorBox')) { document.getElementById('colorPicker').removeChild(document.getElementById('colorTree')); document.getElementById('colorPicker').removeChild(document.getElementById('colorBox')); $('textbox').focus(); } } Greetings. I"m having trouble trying to create a crossbrowser vertical menu with "showhide" submenus. When moving cursor above the submenu in Opera browser, it sometimes disappears. See here. I only guess it's because of hidden divs which however listen to the onmouseout event The code: Code: <script language="javascript"> <!-- function rolldown(number){ /*close others*/ for (i=1;i<=11;i=i+1){ var id='m' + i; if(i != number){ document.getElementById(id).style.display='none';} } /*open this*/ var id='m' + number; document.getElementById(id).style.display='inline'; } --> </script> And the menu sections and submenus go like this: Code: <li onmouseover="rolldown(1);" class="m1"><a href="home.php">home</a> </li> <div id="m1" class="m1" onmouseover="rolldown(1);" onmouseout="javascript:document.getElementById('m1').style.display='none';"> <a href="1.php">1</a> <br /><a href="2.php">2</a> </div> I tried to resolve the issue by destroying the divs' innerHTML, but the fun is it still works in my firefox but opera now even doesn't show the submenus. See here. My code for the latter changed to this: Code: function rolldown(number){ /*close others*/ for (i=1;i<=11;i=i+1){ var id='m' + i; if(i != number){ document.getElementById(id).style.display='none'; document.getElementById(id).innerHTML=''; } } /*open this*/ if(number!=0){ var id='m' + number; //definition of concrete submenus switch(number) { case 1: var htmlstring='<a href="a1.php">a1</a><br /><a href="a2.php">a2</a>'; break; case 2: var htmlstring='<a href="b1.php">b1</a><br /><a href="b2.php">b2</a>'; break; default: var htmlstring=''; } document.getElementById(id).innerHTML=htmlstring; document.getElementById(id).style.display='inline'; } } Can you help solve this whatever way? Thank you!! <BODY onLoad="populateYearSelect()"> <font face="Verdana"> <title>owner Calendar</title> </font> <!--webbot BOT="GeneratedScript" PREVIEW=" " startspan --> function populateYearSelect() { d = new Date(); curr_month = d.getMonth(); document.getElementById('arrivemonth').options[curr_month + 1].selected=true; curr_year = d.getFullYear(); for(i = 0; i <= 3; i++) { document.getElementById('arriveyear').options[i] = new Option(curr_year+i,curr_year+i); } } </script> This is the function I am using and it works great in IE but all other browsers are not even loading the function at all. What must i do to make this work in other browsers? I need them to work more so in Firefox and Safari more so than Opera, Avant or Netscape. Dear All, I need to get JavaScript to change the font size used for a website if Opera is detected. I have been trying this but it hasn't worked: Code: function changeFooter(){ if (navigator.userAgent.indexOf("Opera") >= 0) { // if I alert this line the output is 0 document.getElementById("footer").style.fontSize = '0.5em'; }; }; in the head of the html document (as well as the link to the external JavaScript file): Code: <script type="text/javascript"> changeFooter(); </script> I tried using window.onload = changeFooter(); but still no luck. I used the same principle in a different function to change another css property via getElementById and it works beautifully so I am a bit puzzled. I then realised that I actually need to change the value of the font size in the body tag from 100% to 90% when Opera is detected so I changed the script to this: Code: function changeFooter(){ if (navigator.appName == 'Opera') { document.write('<link href="styleOpera.css" rel="stylesheet" type="text/css" />'); } else { document.write('<link href="style.css" rel="stylesheet" type="text/css" />'); }; }; But it's still not working. I was hoping that I could benefit from your collective wisdom as I am not sure where I am going wrong with this and several hours spent searching the web for answers have been fruitless so far... My knowledge of JavaScript is not very extensive, I haven't studied it in great depth so perhaps I am making some very silly mistakes here. My pseudo code for this exercise is something like this: Code: detect browser if browser = Opera { change font-size for body to 90% } else { do nothing } alternatively: detect browser if browser = Opera { link to stylesheet1 } else { link to stylesheet2 } Thanks in advance for your help, much appreciated. Kind regards, Cristina Alciati Hello, Here is what I have: a regular main window that opens a small pop-up for preview purposes. This pop-up window has a text link to close it and a text link to close it and reach a page with more detail in the main window. I have been trying an infinite number of things so far and I cannot get this last link to work in Opera 10. All workarounds are just fine in FF 3 and IE 8. Here is the function called when clicking the link to "close and go": Code: <script type="text/javascript"> function fermer_extrait() { window.opener.location='http://www.wereIwantToGo.com'; window.close(); } </script> I have tried the same thing with Code: window.opener.location.href='http://www.wereIwantToGo.com'; and some other window property like "outerWidth" for testing purposes. In every case, Opera doesn't do anything when I click that link and I get this error: Code: JavaScript - http://www.mypage.php Event thread: click Error: name: ReferenceError message: Security error: attempted to write protected variable 'href' stacktrace: Line 1 of function script window.opener.location.href='http://www.wereIwantToGo.com'; window.close() "protected variable" will change according to the attempt I made (href, location, outerwidth). I'm gessing there is something very strict in the way Opera handles javascript. I'm a beginner and I have reached my limits. This is where I ask for help... So, how can I get that pop-up to close and get the main window to change location? Thanks in advance for any help! Hello and thanks for the help. I'm no expert by any means, and I have no idea what the problem could be. Internet Explorer crops my images on my image fade, but Chrome and Safari view it just fine. the website is www.pisanchynproductions.com If you open it in IE and Chrome you can see Chrome shows image fadeshow fine, and IE crops the images. For the record, I don't want the images cropped. The problem must be in here somewhere. Code: var fadeimages=new Array() //SET IMAGE PATHS. Extend or contract array as needed fadeimages[0]=["images/SSPP1.JPG", "", ""] //plain image syntax fadeimages[1]=["images/SSPP2.JPG", "", ""] //plain image syntax fadeimages[2]=["images/SSPP3.JPG", "", ""] //plain image syntax fadeimages[3]=["images/SSPP4.JPG", "", ""] //plain image syntax fadeimages[4]=["images/SSPP5.JPG", "", ""] //plain image syntax fadeimages[5]=["images/SSPP6.JPG", "", ""] //plain image syntax fadeimages[6]=["images/SSPP7.JPG", "", ""] //plain image syntax fadeimages[7]=["images/SSPP11.JPG", "", ""] //plain image syntax fadeimages[8]=["images/SSPP12.JPG", "", ""] //plain image syntax fadeimages[9]=["images/SSPP13.JPG", "", ""] //plain image syntax fadeimages[10]=["images/SSPP14.JPG", "", ""] //plain image syntax var fadebgcolor="white" var fadearray=new Array() //array to cache fadeshow instances var fadeclear=new Array() //array to cache corresponding clearinterval pointers var dom=(document.getElementById) //modern dom browsers var iebrowser=document.all function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder){ this.pausecheck=pause this.mouseovercheck=0 this.delay=delay this.degree=10 //initial opacity degree (10%) this.curimageindex=0 this.nextimageindex=1 fadearray[fadearray.length]=this this.slideshowid=fadearray.length-1 this.canvasbase="canvas"+this.slideshowid this.curcanvas=this.canvasbase+"_0" if (typeof displayorder!="undefined") theimages.sort(function() {return 0.5 - Math.random();}) this.theimages=theimages this.imageborder=parseInt(borderwidth) this.postimages=new Array() //preload images for (var p=0;p<theimages.length;p++){ this.postimages[p]=new Image() this.postimages[p].src=theimages[p][0] } var fadewidth=fadewidth+this.imageborder*2 var fadeheight=fadeheight+this.imageborder*2 if (iebrowser&&dom||dom) //if IE5+ or modern browsers (ie: Firefox) document.write('<div id="master'+this.slideshowid+'" style="position:relative;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow;"><div id="'+this.canvasbase+'_0" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div><div id="'+this.canvasbase+'_1" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div></div>') else document.write('<div><img name="defaultslide'+this.slideshowid+'" src="'+this.postimages[0].src+'"></div>') if (iebrowser&&dom||dom) //if IE5+ or modern browsers such as Firefox this.startit() else{ this.curimageindex++ setInterval("fadearray["+this.slideshowid+"].rotateimage()", this.delay) } } function fadepic(obj){ if (obj.degree<100){ obj.degree+=10 /*@cc_on @*/ /*@if(@_jscript_version >= 5) try{ @end @*/ if (obj.tempobj.filters&&obj.tempobj.filters[0]){ if (typeof obj.tempobj.filters[0].opacity=="number") //if IE6+ obj.tempobj.filters[0].opacity=obj.degree else //else if IE5.5- obj.tempobj.style.filter="alpha(opacity="+obj.degree+")" } else if (obj.tempobj.style.MozOpacity) obj.tempobj.style.MozOpacity=obj.degree/101 else if (obj.tempobj.style.KhtmlOpacity) obj.tempobj.style.KhtmlOpacity=obj.degree/100 else if (obj.tempobj.style.opacity&&!obj.tempobj.filters) obj.tempobj.style.opacity=obj.degree/101 /*@cc_on @*/ /*@if(@_jscript_version >= 5) } catch(e){} @end @*/ } else{ clearInterval(fadeclear[obj.slideshowid]) obj.nextcanvas=(obj.curcanvas==obj.canvasbase+"_0")? obj.canvasbase+"_0" : obj.canvasbase+"_1" obj.tempobj=iebrowser? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas) obj.populateslide(obj.tempobj, obj.nextimageindex) obj.nextimageindex=(obj.nextimageindex<obj.postimages.length-1)? obj.nextimageindex+1 : 0 setTimeout("fadearray["+obj.slideshowid+"].rotateimage()", obj.delay) } } fadeshow.prototype.populateslide=function(picobj, picindex){ var slideHTML="" if (this.theimages[picindex][1]!="gallery") //if associated link exists for image slideHTML='<a href="'+this.theimages[picindex][1]+'" rel="nofollow" target="'+this.theimages[picindex][2]+'">' slideHTML+='<img src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px">' if (this.theimages[picindex][1]!="gallery") //if associated link exists for image slideHTML+='</a>' picobj.innerHTML=slideHTML } fadeshow.prototype.rotateimage=function(){ if (this.pausecheck==1) //if pause onMouseover enabled, cache object var cacheobj=this if (this.mouseovercheck==1) setTimeout(function(){cacheobj.rotateimage()}, 100) else if (iebrowser&&dom||dom){ this.resetit() var crossobj=this.tempobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas) crossobj.style.zIndex++ if(document.getElementById('content')) document.getElementById('content').style.zIndex++ fadeclear[this.slideshowid]=setInterval("fadepic(fadearray["+this.slideshowid+"])",50) this.curcanvas=(this.curcanvas==this.canvasbase+"_0")? this.canvasbase+"_1" : this.canvasbase+"_0" } else{ var ns4imgobj=document.images['defaultslide'+this.slideshowid] ns4imgobj.src=this.postimages[this.curimageindex].src } this.curimageindex=(this.curimageindex<this.postimages.length-1)? this.curimageindex+1 : 0 } fadeshow.prototype.resetit=function(){ this.degree=10 var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas) /*@cc_on @*/ /*@if(@_jscript_version >= 5) try{ @end @*/ if (crossobj.filters&&crossobj.filters[0]){ if (typeof crossobj.filters[0].opacity=="number") //if IE6+ crossobj.filters(0).opacity=this.degree else //else if IE5.5- crossobj.style.filter="alpha(opacity="+this.degree+")" } else if (crossobj.style.MozOpacity) crossobj.style.MozOpacity=this.degree/101 else if (crossobj.style.KhtmlOpacity) crossobj.style.KhtmlOpacity=this.degree/100 else if (crossobj.style.opacity&&!crossobj.filters) crossobj.style.opacity=this.degree/101 /*@cc_on @*/ /*@if(@_jscript_version >= 5) }catch(e){} @end @*/ } fadeshow.prototype.startit=function(){ var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas) this.populateslide(crossobj, this.curimageindex) if (this.pausecheck==1){ //IF SLIDESHOW SHOULD PAUSE ONMOUSEOVER var cacheobj=this var crossobjcontainer=iebrowser? iebrowser["master"+this.slideshowid] : document.getElementById("master"+this.slideshowid) crossobjcontainer.onmouseover=function(){cacheobj.mouseovercheck=1} crossobjcontainer.onmouseout=function(){cacheobj.mouseovercheck=0} } this.rotateimage() } I wish i knew more so I could realized how dumb this question was. This might be a little complicated. I'll try to be as clear as possible. I got some help from Old Pedant a little while ago and the code worked great. The problem came after I tried some code that will highlight (select) text in a DIV: Code: <script type="text/javascript"> function selectNode (node) { var selection, range, doc, win; if ((doc = node.ownerDocument) && (win = doc.defaultView) && typeof win.getSelection != 'undefined' && typeof doc.createRange != 'undefined' && (selection = window.getSelection()) && typeof selection.removeAllRanges != 'undefined') { range = doc.createRange(); range.selectNode(node); selection.removeAllRanges(); selection.addRange(range); } else if (document.body && typeof document.body.createTextRange != 'undefined' && (range = document.body.createTextRange())) { range.moveToElementText(node); range.select(); } } </script> Code: <div id="bb1"></div> <form> <input type="button" value="Click Here to Highlight Data" onclick="window.selectNode(document.getElementById('bb1'));" style="margin-left:4px; font-weight:bold; font-family: Verdana, Arial, Helvetica, sans-serif; font-size:14px;"> </form> It works great with Firefox and Internet Explorer, but there is a problem with Opera. The contents of the DIV is selected, but so is everything after the DIV. Below is a link to the page, but be sure to turn down your speaker volume before you visit the page so you won't have a heart attack: http://www.randomterrain.com/atari-2...music-toy.html The DIV is empty when the page loads. To put content in the DIV, jump down to All Sounds and left click on a couple of the numbers than run from 0 to 31, then jump down to the DIV. When you click on the "Click Here to Highlight Data" button, you'll see that more than the contents of the DIV is selected. I hope someone can figure out how to make the code work properly with Opera. Thanks. Hello, I've searched high and low for some decent code that will allow a visitor to a website to bookmark the site through a hyperlink. The bookmarking is done through a javascript function that looks like this: Code: function OnBookmarkButtonClick (e) { if (window.sidebar) { // Mozilla Firefox Bookmark window.sidebar.addPanel("TimeSheet", window.document.location,""); } else if (window.external) { // IE Favorite window.external.AddFavorite( window.document.location, "TimeSheet"); } } I need to add some detection for Opera, Safari, and Chrome. Please note that it must be feature detection, not browser detection. But as I said, I've searched high and low for this, and couldn't find anything. Help is much appreciated. We are building an opera extension in which we are trying to use the document object property (document.body.innerHTML) in order to obtain the source of the main page of a site. In most cases it provides us with the correct page source but for certain sites (ones that have multiple document layers), it doesn't return the top most document. For instance, for the site (https://www.pcisecuritystandards.org/) we would like to source for the main page that is displayed but once the entire page is loaded, the document property would display the source for another layer (https://s7.addthis.com/static/r07/sh...rev=86981&xd=1) This perhaps has to do with how opera loads the document layers in a page. We did not face any issue with any other browser How can we obtain the source of the main page (https://www.pcisecuritystandards.org/) using the document object in Opera ? Any ideas on how I can make this work in IE as well?? It is a code that shows a divide on click and then hides the rest at the same time. live code is also at chryscreations.com/ns/boynames.html Javascript: Code: function showstuff(divID) { els=document.getElementsByName('mydiv') for (var i = 0; i < els.length; i++) { els[i].style.visibility="hidden"; els[i].style.display="none"; } document.getElementById(divID).style.visibility="visible"; document.getElementById(divID).style.display="block"; } HTML Code: <head> <script> window.onload=function() { showstuff(''); } </script> </head> <body> <a href="javascript:showstuff('adivide')">A</a> <a href="javascript:showstuff('bdivide')">B</a> <div name="mydiv" id="adivide"></div> <div name="mydiv" id="bdivide"></div> <body> |