JavaScript - Print() Problem In Opera Browser
Similar TutorialsHi, Ours is a web based application. In a particular use case, print-receipt; we pull up data from database and display it a new window ... followed by a javascript::window.print() To print the content. But this prints the browser window - in graphic mode. The target printer, attached to the browser machine is a Dot matrix printer; and consumes a lot off time to print a single window (because of the graphic nature) Can the printing be done in text mode ? thank you. jeevan 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'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 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!! 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. i don't know what has changed in last releases of Firefox and Opera but before i used this script to detect browser versions (IE, Opera, FF) and block or redirect depending on version Code: <script language="javascript"> <!-- //Detect IE greater than 1 - we are blocking it completely version=0 if (navigator.appVersion.indexOf("MSIE")!=-1){ temp=navigator.appVersion.split("MSIE") version=parseFloat(temp[1]) } if (version>1) window.location="ie-error.html" //Detect Opera less than 10 (9.80) if (navigator.userAgent.indexOf("Opera")!=-1){ var versionindex=navigator.userAgent.indexOf("Opera")+6 if (parseInt(navigator.userAgent.charAt(versionindex))<9.8) window.location="op-error.html" else (window.location="index2.html") } //Detect Firefox less than 3.6 if (navigator.userAgent.indexOf("Firefox")!=-1){ var versionindex=navigator.userAgent.indexOf("Firefox")+8 if (parseInt(navigator.userAgent.charAt(versionindex))<3.6) window.location="ff-error.html" else (window.location="index2.html") } // --> </script> it worked last with Opera 9.5, FF 3.0 but after that it doesnt work at all Firefox'es version (3.6) doesn't get detected and is redirected to error page same goes with Opera (9.8 which is 10.0-10.5) can anyone tell me why this happens ? or can anyone "fix it" i know many people are against this kind of scripts (blockers and redirecters) but i do it so people who come with older and less compatible browsers with W3C standards to get warned so they don't load deformed page Hi I have spent some time writing a javascript online calculator. The calculator works on Safari and Firefox but not on IE or Opera. I am sure there are multiple errors in the code but have gone as far as my limited self taught experience will take me. Any help will be greatly appreciated! Here's the code I have put together. Thanks David [code] <html> <head> <script> function bettype(elm) { var bettype = elm.options[elm.selectedIndex].value; if(bettype == "qualifyingbet") { var betamount = document.form.betamount.value; var betodds = document.form.betodds.value; var betcommission = document.form.betcommission.value; var layodds = document.form.layodds.value; var laycommission = document.form.laycommission.value; var betstakereturn = parseFloat(betamount) document.form.betstakereturn.value = (betstakereturn.toFixed(2)); var betwincommissioncharged = parseFloat(betamount)*parseFloat(betodds-1)*parseFloat(betcommission/100) document.form.betwincommissioncharged.value = (betwincommissioncharged.toFixed(2)); var betreturn = parseFloat((betodds-1)*parseFloat(betamount))-parseFloat(betwincommissioncharged)+parseFloat(betstakereturn) document.form.betreturn.value = (betreturn.toFixed(2)); var betprofit = parseFloat(betreturn)-parseFloat(betamount) document.form.betprofit.value = (betprofit.toFixed(2)); var layamount = parseFloat(betreturn)/parseFloat(layodds-laycommission/100) document.form.layamount.value = (layamount.toFixed(2)); var layliability = parseFloat(layamount)*parseFloat(layodds-1) document.form.layliability.value = (layliability.toFixed(2)); var netprofit = parseFloat(betprofit)-parseFloat(layliability) document.form.netprofit.value = (netprofit.toFixed(2)); var percentretained = 100+parseFloat(netprofit/betamount*100) document.form.percentretained.value = (percentretained.toFixed(2)); } else if(bettype == "freebetstakereturned") { var betamount = document.form.betamount.value; var betodds = document.form.betodds.value; var betcommission = document.form.betcommission.value; var layodds = document.form.layodds.value; var laycommission = document.form.laycommission.value; var betstakereturn = parseFloat(betamount) document.form.betstakereturn.value = (betstakereturn.toFixed(2)); var betwincommissioncharged = parseFloat(betamount)*parseFloat(betodds-1)*parseFloat(betcommission/100) document.form.betwincommissioncharged.value = (betwincommissioncharged.toFixed(2)); var betreturn = parseFloat((betodds-1)*parseFloat(betamount))-parseFloat(betwincommissioncharged)+parseFloat(betstakereturn) document.form.betreturn.value = (betreturn.toFixed(2)); var betprofit = parseFloat(betreturn) document.form.betprofit.value = (betprofit.toFixed(2)); var layamount = parseFloat(betreturn)/parseFloat(layodds-laycommission/100) document.form.layamount.value = (layamount.toFixed(2)); var layliability = parseFloat(layamount)*parseFloat(layodds-1) document.form.layliability.value = (layliability.toFixed(2)); var netprofit = parseFloat(betprofit)-parseFloat(layliability) document.form.netprofit.value = (netprofit.toFixed(2)); var percentretained = parseFloat(netprofit/betamount*100) document.form.percentretained.value = (percentretained.toFixed(2)); } else if(bettype == "freebetstakenotreturned") { var betamount = document.form.betamount.value; var betodds = document.form.betodds.value; var betcommission = document.form.betcommission.value; var layodds = document.form.layodds.value; var laycommission = document.form.laycommission.value; var betstakereturn = 0 document.form.betstakereturn.value = (betstakereturn.toFixed(2)); var betwincommissioncharged = parseFloat(betamount)*parseFloat(betodds-1)*parseFloat(betcommission/100) document.form.betwincommissioncharged.value = (betwincommissioncharged.toFixed(2)); var betreturn = parseFloat((betodds-1)*parseFloat(betamount))-parseFloat(betwincommissioncharged)+parseFloat(betstakereturn) document.form.betreturn.value = (betreturn.toFixed(2)); var betprofit = parseFloat(betreturn) document.form.betprofit.value = (betprofit.toFixed(2)); var layamount = parseFloat(betreturn)/parseFloat(layodds-laycommission/100) document.form.layamount.value = (layamount.toFixed(2)); var layliability = parseFloat(layamount)*parseFloat(layodds-1) document.form.layliability.value = (layliability.toFixed(2)); var netprofit = parseFloat(betprofit)-parseFloat(layliability) document.form.netprofit.value = (netprofit.toFixed(2)); var percentretained = parseFloat(netprofit/betamount*100) document.form.percentretained.value = (percentretained.toFixed(2)); } else { window.alert("Please select a bet type!"); } } </script> </head> <body> 1. Select bet type<br> 2. Enter bookmaker and betting exchange details<br> 3. Apply betting exchange details<br> 4. Results for your information </span> <table width="100%" align="center"> <tr align="center"> <td> <table border="1" width="445"> <tr align="center"> <td> <table border="0" cellpadding="0" cellspacing="0"> <tr> <td align="center"> <form name="form"> <select name="betoption" id="betoption" style="width:273px;"> <option value="typeofbet">Type of Bet. Please Select</option> <option value="qualifyingbet">Qualifying Bet</option> <option value="freebetstakereturned">Free Bet Stake Returned</option> <option value="freebetstakenotreturned">Free Bet Stake Not Returned</option> </select> </td> </tr> </table> </td> </tr> <tr> <td> <table border="0"> <tr align="center"> <td colspan="3"> Bet (Bookmaker) Details </td> </tr> <tr> <td width="140" align="center"> Bet Amount: £ </td> <td width="140" align="center"> Bet Odds: </td> <td width="140" align="center"> Bet Commission: % </td> </tr> <tr> <td width="140" align="center"> <input type="text" name="betamount" value="0" onfocus="(value='')" size="5" maxlength="5"> </td> <td width="140" align="center"> <input type="text" name="betodds" value="0" onfocus="(value='')" size="5" maxlength="5"> </td> <td width="140" align="center"> <input type="text" name="betcommission" value="0" onfocus="(value='')" size="5" maxlength="5"> </td> </tr> </table> </td> </tr> <tr> <td> <table border="0"> <tr align="center"> <td colspan="4"> Lay (Betting Exchange) Details </td> </tr> <tr> <td width="210" align="center"> Lay Odds: </td> <td width="210" align="center"> Lay Commission: % </td> </tr> <tr> <td width="212" align="center"> <input type="text" name="layodds" value="0" onfocus="(value='')" size="5" maxlength="5"> </td> <td width="212" align="center"> <input type="text" name="laycommission" value="0" onfocus="(value='')" size="5" maxlength="5"> </td> </tr> <tr> <td width="212" align="center"> Lay Amount: £ </td> <td width="212" align="center"> Lay Liability: £ </td> </tr> <tr> <td width="212" align="center"> <input type="text" name="layamount" size="5" readonly="readonly"> </td> <td width="212" align="center"> <input type="text" name="layliability" size="5" readonly="readonly"> </td> </tr> </table> </td> </tr> <tr> <td> <table border="0"> <tr align="center"> <td colspan="2" align="center"> For Your Information </td> </tr> <tr> <td width="212" align="center"> Net Profit: £ </td> <td width="212" align="center"> Percentage retained: % </td> </tr> <tr> <td width="212" align="center"> <input type="text" name="netprofit" size="5" readonly="readonly"> <td width="212" align="center"> <input type="text" name="percentretained" size="5" readonly="readonly"> </td> </tr> </table> <input type="hidden" name="betstakereturn" value="0" size="5" > <input type="hidden" name="betwincommissioncharged" value="0" size="5" > <input type="hidden" name="betreturn" size="5" > <input type="hidden" name="betprofit" size="5" > <table border="0"> <tr align="center"> <td width="212" align="center"> <button type="reset" value="Reset">Reset</button> </td> </form> <td width="212" align="center"> <input type="submit" value="Calculate" onclick="bettype(betoption);"> </td> </tr> </table> </td> </tr> </table> </td> </tr> </table> </body> </html> [code] Hello again , I have another question, I am trying to make a javascript timer that times in tenths of seconds (eg. 1.6 seconds). I have made what I believe to be suitable code but I think that it can't be very effiecient as the code won't run because the browser crashes. Here is the code: Code: function seconds() { while (timergoing=1) { tenthseconds=tenthseconds+1; if (tenthseconds=10) { tenthseconds=0; seconds=seconds+1; } } } function timer() { timergoing=1; tenthseconds=0; seconds=0; setInterval('seconds()', 100); while (timergoing=1) { document.getElementById('timeis').innerHTML = seconds + '.' + tenthseconds + 'seconds'; } } And for the HTML: Code: <button type="button" onclick="timer()">Start</button> <br><br> <div id="timeis"></div> I have a page up with an iframe that's approximately 300px by 405px. When I load up the site in FF and IE, it frames just fine. However, in Chrome and Opera the iframe is shifted upwards and is off-frame. I've tried looking for a solution to center the iframe correctly. Someone said to make a php code that loads 2 different iframes depending on browser (1 iframe for IE/FF and another frame for OP/CH). I have no knowledge of php coding, so I couldn't get it to work. So now, I think I'm limited to redirecting users based on browser type. If the user is using FF or IE, I'll redirect them to my original page. If they're using some other browser, I'll redirect them to a different page without the iframe. I've tried to set up a redirector, but it has trouble distinguishing between FF and Chrome. It treats them exactly the same. Does anyone have any advice on what to do? I've done tons of searching for what seems to be such a small problem. Someone please enlighten me. I need a script that will redirect to a specific page is the browser is safari version 4. if the browser is NOT safari 4 I want the browser to stay on the current page.
Greetings, I am currently using the websites tutorial about browser detection using the navigator. http://www.javascriptkit.com/javatutors/navigator.shtml I am however finding myself unable to detect a pattern in order to learn from. My aim is to use Browser detection to have a CSS file for each browser type, such as Firefox, IE, Opera, Safari and then an overall CSS file if none of the above, to fix numerous flaws. For IE and Firefox using the site's code is all well and good and while I haven't tested it yet I'm wondering how to set up the coding so that it can detect a safari browser. There are lots of slashes and d's and brackets and I do find myself unable to understand their purpose. So if someone can explain how I could do it for Safari I would be very appreciative. Hello, I have a question what is the best way to identify a browser, browser version and OS in javascript. I have try a few scripts but they all fail. This will help me out formating the code for diferent browsers. Thanks 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
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?
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. http://javascript.internet.com/misce...lide-show.html any ideas to get this crossfading outside IE? 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! 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(); } } <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. |