JavaScript - Setting The Browsers Language
Hi Guys ,
This is the urgnt requirement , I want to change the Browsers setting languge through java script ,and according to it , The data wht I enter dhould be change .Thanks In advance Similar TutorialsI need to program a language protocol compatibility patch for multiple OS'. I don't know where to start, I'm new to programming BUT at least I know what is needed. If anyone is willing to help, I'm willing to elaborate.
I would like to ask people's opinions as to which "offline" language is most similar to javascript? I don't program for a living, but I have been learning javascript in my spare time. I would now like to have a shot at making a desktop application, and I think it would help to choose one which is most similar, if at all possible, to javascript? e.g. python, ruby, C#, visual basic ... I have no idea and haven't had much luck googling this Thanks Matt Hey everyone I just signed up to this forum. I have been doing a cert IV in Networking IT and part of my course involves javascript. Its all pretty simple, but we dont really have a teacher who I can ask questions. Im have a dead line tonight for a heap of work and I just keep running into so many problems. They are all pretty simple, but I just am at the end of my thread (no pun intended). At the moment Im just working on a box form, and I keep getting object expected errors in relation to my onClick and undefined with my elements. Code: <head> <meta name="author" content= "5h!fTyLiV3z" /> <title>Pay Rate Calculater</title> <SCRIPT LANGUAGE="JavaScript"> function calulatePay() { var elements; var rate = eval(document.payForm.elements[0].value); var hours = eval(document.payForm.elements[1].value); var prod = rate * hours; if (isNaN(element[counter].value) || (element[counter].value == "") ) { if (hours >= 20) { alert("You earned $" + (prod+(hours*2)) + " in " + hours + " hours.") } else { alert("You earned $" + prod + " in " + hours + " hours.") } } else { alert ("Enter numbers please"); } } </SCRIPT> </head> <body> <FORM onSubmit="" NAME="payForm"> <CENTER> <TABLE ALIGN="CENTER" BGCOLOR="#888888" BORDER="3" CELLPADDING="5"> <TR> <TD BGCOLOR="#004080"> <FONT COLOR="#ffffff" FACE="Arial"><B>Calculate My Weekly Pay</B></FONT> </TD> </TR> <TR> <TD> <CENTER> $ <INPUT TYPE="number" NAME="rate" SIZE="11" MAXLENGTH="8" VALUE="Enter pay rate"> : <INPUT TYPE="number" NAME="hours" SIZE="16" MAXLENGTH="8" VALUE="Enter hours worked"> <INPUT TYPE="button" VALUE="Calculate" onClick='calulatePay()'> </CENTER> </TD> </TR> </TABLE> </CENTER> </FORM> </body> I know its all a bit sloppy, but Im just trying to rush though so much work... Any help would be great. If everyone is active tonight I probably will be. Normally I dont have this many problems, but I guess its just exam pressure... Cheers 5hifty I'm currently using an automation software to automate a series of steps I perform on my computer. One of the tasks involves hundreds of If/Then loops, extracts text from websites using an embedded web browser, computes equations and write text files. The thing is, in order to share this with somebody else, they also need the same automation software installed, and then need to import it. So it's a process I'm trying to replace by creating a small program with a GUI that involves a simple installation on the user's PC (or ideally without installation). The language must be flexible enough to perform the same actions that I listed above - and more preferably. I'm a complete novice with anything besides HTML/CSS so I'm looking for A flexible programming language that isn't rocket science to learn from scratch and is ideal for small stand-alone programs The ability to create a GUI. I'd be happy to read any good reference you have about the language/design knowledge needed for GUI's. Thanks in advance Hello, I would like to add multi-language support on the website. So far i have the following code which enables a drop down menu. I would rather prefer a flags instead of a drop down menu. Please help. Thank you very much. PHP Code: <div id="google_translate_element" class="right"></div> <script> function googleTranslateElementInit() { new google.translate.TranslateElement({ pageLanguage: 'en', includedLanguages: 'en,fr,de,it,es', gaTrack: true, gaId: 'UA-28770952-1', layout: google.translate.TranslateElement.InlineLayout.HORIZONTAL }, 'google_translate_element'); } </script><script src="//translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script> Any one have any idea how to make a Java scorecard... If any one have code than please send me i have to submit it on my project... please help mee...
Hi Folks, I'm developing a software tool that can create the basic software outline (classes, modules, functions) from natural language. (The problem definition document for example) The benefits of a initial software structure are an enhanced software performance, and a greater adaptability later on. I was wondering for what purposes this tool would be interesting? And if an integrating this with a programming language would be interesting, so a pre-programmed code divided over several classes emerges. Best regards, viaBox -=-=-=-=-=-=-=-=-=-=-=-=-=-=- http://budurl.com/ViaBox =-=-=-=-=-=-=-=-=-=-=-=-=-=-= I am not super familiar with code - I can easily take code and with a little direction get the desired end result so anyone who can help me with this it will be VERY appreciated. I don't even know what terms to search in order to create a page that I am looking for.... So here goes: I want to model our distributor page after a R E D K E N.com Distributor Locator Page. Here is what happens.... There is a drop down menu of the 50 states, and when you select the state the table of information below changes. screen shots below I am sure this is fairly easy to resolve, however I don't know where to begin. Thank You in advance for your time. Kristi I want to have a browser language detection for 2 languages for Explorer and Firefox and struggle a little to make it work. I don't know really much about JavaScript so I guess I did some grave errors. It works for one language though, but for that I don't really detection. I am not sure if that's wrong, but I try to look for the 'en-' in the language not to deal separately with en-US, en-AU, en-UK etc. PHP Code: <script type="text/javascript"> var str=navigator.language; x = (str.search(/en-/i)); if ( !(x=='-1') ) { document.write("English Mozilla"); } var expl=navigator.browserLanguage; ex = (expl.search(/en-/i)); if ( !(ex=='-1') ) { document.write("Englisch1 Explorer"); } var dm=navigator.language; d1 = (dm.search(/de-/i)); if ( !(d1=='-1') ) { document.write("German Mozilla"); } var dex=navigator.browserLanguage; dexpl = (dex.search(/de-/i)); if ( !(dexpl=='-1') ) { document.write("German Explorer"); } </script> Hi, I'm currently trying to get javascript to work with internet explorer. I managed to get one part of the translation file to work. It's a javascript to change some of the words on Facebook from English to Secwepemc (native american language). The original file works in Firefox and Chrome but not in safari. I knew it was because internet explorer has its own parameters. A file works completely for FF and chrome but not for IE. So, I changed the language a bit so that IE can understand it. Now I have one part of the translation working but not the others. I am wondering if it would be better to use ID's, names, and class all together to get the english words I want to change. I am using grease monkey for IE to use this script. I know firefox and chrome are much better but the plan is for everyone to use and some people still use IE. I know that if I have part of the words translating, then it must be the wrong identifiers. If someone can either help me find the right identifiers or if I missed changing syntax from FF and Chrome to IE, that would be amazing! Here is the javascript file. Code: var es = new Array(); es["Home"] = "Tsitcw"; es["News Feed"] = "Lexeyem"; es["Friends"] = "Kweselkten"; es["Like"] = "Xwexwisten"; es[" likes this."] = " r xwexwistes."; es["Today"] = "Pyin Te Sitqt"; es["Say hello."] = "Say weytk."; es["Say hi."] = "Say weytk."; es["Tomorrow"] = "Pexweyt"; es["What are you planning?"] = "Me7 Stemi ke7 tsuwet?"; es["Where?"] = "T'he7en"; es["Who's invited?"] = "Sweti7?"; es["What's on your mind?"] = "Stemi ke7 peti'nesme?"; function loadSecwepemc() { var fbelem = document.getElementsByTagName('a'); for (var i = 0; i < fbelem.length; i++) { var thisElem = fbelem[i]; if (thisElem.innerText in es) { thisElem.innerText = es[thisElem.innerText]; } } var fbelem = document.getElementsByTagName('span'); for (var i = 0; i < fbelem.length; i++) { var thisElem = fbelem[i]; if (thisElem.innerText in es) { thisElem.innerText = es[thisElem.innerText]; } } var fbelem = document.getElementsByClassName('ego_social_context'); for (var i = 0; i < fbelem.length; i++) { var thisElem = fbelem[i]; if (thisElem.innerText in es) { thisElem.innerText = es[thisElem.innerText]; } } var fbelem = document.getElementsByTagName('input'); for (var i = 0; i < fbelem.length; i++) { var thisElem = fbelem[i]; if (thisElem.getAttribute('placeholder') in es) { thisElem.setAttribute('placeholder',es[thisElem.getAttribute('placeholder')]); } if (thisElem.getAttribute('value') in es) { thisElem.setAttribute('value',es[thisElem.getAttribute('value')]); } } var fbelem = document.getElementsByTagName('textarea'); for (var i = 0; i < fbelem.length; i++) { var thisElem = fbelem[i]; if (thisElem.getAttribute('placeholder') in es) { thisElem.setAttribute('placeholder',es[thisElem.getAttribute('placeholder')]); } if (thisElem.getAttribute('title') in es) { thisElem.setAttribute('title',es[thisElem.getAttribute('title')]); } if (thisElem.innerText in es) { thisElem.innerText = es[thisElem.innerText]; } } var fbelem = document.getElementsByTagName('h3'); for (var i = 0; i < fbelem.length; i++) { var thisElem = fbelem[i]; if (thisElem.innerText in es) { thisElem.innerText = es[thisElem.innerText]; thisElem.attachEvent( "onClick", loadSecwepemc()); // capture phase } } var fbelem = document.getElementsByTagName('h2'); for (var i = 0; i < fbelem.length; i++) { var thisElem = fbelem[i]; if (thisElem.innerText in es) { icon = thisElem.childNodes[0] thisElem.innerText = es[thisElem.innerText]; thisElem.appendChild(icon) } } } loadSecwepemc(); function changedNode(e) { var fbelem = e.target.getElementsByTagName('a'); for (var i = 0; i < fbelem.length; i++) { var thisElem = fbelem[i]; if (thisElem.innerText in es) { thisElem.innerText = es[thisElem.innerText]; } } var fbelem = e.target.getElementsByTagName('span'); for (var i = 0; i < fbelem.length; i++) { var thisElem = fbelem[i]; if (thisElem.innerText in es) { thisElem.innerText = es[thisElem.innerText]; thisElem.attachEvent( "onLoad", loadSecwepemc()); // capture phase } } var fbelem = e.target.getElementsByClassName('ego_social_context'); for (var i = 0; i < fbelem.length; i++) { var thisElem = fbelem[i]; if (thisElem.innerText in es) { thisElem.innerText = es[thisElem.innerText]; } } var fbelem = e.target.getElementsByTagName('input'); for (var i = 0; i < fbelem.length; i++) { var thisElem = fbelem[i]; if (thisElem.getAttribute('placeholder') in es) { thisElem.setAttribute('placeholder',es[thisElem.getAttribute('placeholder')]); } if (thisElem.getAttribute('value') in es) { thisElem.setAttribute('value',es[thisElem.getAttribute('value')]); } } var fbelem = document.getElementsByTagName('textarea'); for (var i = 0; i < fbelem.length; i++) { var thisElem = fbelem[i]; if (thisElem.getAttribute('placeholder') in es) { thisElem.setAttribute('placeholder',es[thisElem.getAttribute('placeholder')]); } if (thisElem.getAttribute('title') in es) { thisElem.setAttribute('title',es[thisElem.getAttribute('title')]); } if (thisElem.innerText in es) { thisElem.innerText = es[thisElem.innerText]; } } var fbelem = e.target.getElementsByTagName('h3'); for (var i = 0; i < fbelem.length; i++) { var thisElem = fbelem[i]; if (thisElem.innerText in es) { thisElem.innerText = es[thisElem.innerText]; thisElem.attachEvent( "onClick", loadSecwepemc()); // capture phase } } var fbelem = e.target.getElementsByTagName('h2'); for (var i = 0; i < fbelem.length; i++) { var thisElem = fbelem[i]; if (thisElem.innerText in es) { icon = thisElem.childNodes[0] thisElem.innerText = es[thisElem.innerText]; thisElem.appendChild(icon) } } } document.attachEvent('onNodeInserted', changedNode()); I feel a little stupid to ask this question but it has always been on my mind. <html> <head> <script type="text/javascript"> { var lastMod = new Date (document.lastModified); document.write ("<p>Document last modified "); document.write ((lastMod.getMonth() +1) + "-" + lastMod.getDate() + "-" + lastMod.getFullYear()); document.write ("<p>"); } </script> </head> </html> when i open in ie or ff it renders 2/25/11 (supposed to be 2/26/11) but when i use it in chrome or an html test is renders correctly. why? 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> Hey everyone, So I just got my DIV named ".center2" to autoscroll. Well, it works when I view it live on Dreamweaver CS5, but when I open it on Safari...nothing. Could anyone help me optimize the code for all web browsers? Thanks! The targeted code is marked in red: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <script type="text/javascript"> function MM_swapImgRestore() { //v3.0 var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } function MM_preloadImages() { //v3.0 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array(); var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++) if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}} } function MM_findObj(n, d) { //v4.01 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x && d.getElementById) x=d.getElementById(n); return x; } function MM_swapImage() { //v3.0 var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3) if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];} } var defaultStep=1; var step=defaultStep; var timer; function scrollDiv(id,s){ var obj=document.getElementById(id); var iScrollTop = obj.scrollTop; step=s||step; if (iScrollTop == 0){ step=defaultStep; } else if (obj.clientHeight + iScrollTop - obj.scrollHeight==0){ step=-defaultStep; } clearTimeout(timer); obj.scrollTop+=step; timer=setTimeout(function(){ scrollDiv(id); },100) } function stopMe(){ clearTimeout(timer); } function scrollMe(id){ scrollDiv(id) } </script> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Aylonetic Sounds [v1.1] | News</title> <style type="text/css"> .center { margin:auto; width:1024px; } .center2 { width:1024px; height:450px; border:none; overflow:scroll; } #apDiv2 { position:relative; width:50px; height:30px; z-index:0; left: 611px; top: 0px; } body { background-color: #000; } </style> </head> <body onload="MM_preloadImages('titlehover.jpg','marketplacehover.jpg','forumshover.jpg','supporthover.jpg','abouthover.jpg','images/title_new_hover_inv.jpg','images/marketplace_new_hover_inv.jpg','images/forums_new5_hover_inv.jpg','images/support_new_hover_inv.jpg','images/about_new_hover_inv.jpg')"> <div class="center"> <table width="1025" border="0"> <tr> <td width="673"><a href="index.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image7','','images/title_new_hover_inv.jpg',1)"><img src="images/title_new_main_inv.jpg" name="Image7" width="150" height="14" border="0" id="Image7" /></a></td> <td width="46"><img src="images/news_new_hover_inv.jpg" width="58" height="14" /></td> <td width="101"><a href="marketplace.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image8','','images/marketplace_new_hover_inv.jpg',1)"><img src="images/marketplace_new_main_inv.jpg" name="Image8" width="100" height="14" border="0" id="Image8" /></a></td> <td width="63"><a href="forums.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image9','','images/forums_new5_hover_inv.jpg',1)"><img src="images/forums_new5_main_inv.jpg" name="Image9" width="65" height="14" border="0" id="Image9" /></a></td> <td width="69"><a href="support.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image10','','images/support_new_hover_inv.jpg',1)"><img src="images/support_new_main_inv.jpg" name="Image10" width="70" height="14" border="0" id="Image10" /></a></td> <td width="47"><a href="about.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image11','','images/about_new_hover_inv.jpg',1)"><img src="images/about_new_main_inv.jpg" name="Image11" width="58" height="14" border="0" id="Image11" /></a></td> </tr> </table> <table width="1024" border="0"> <tr bgcolor="#FFFFFF"> <td width="507"><img src="images/banner1.jpg" width="507" height="150" border="0" /></td> <td width="507"><img src="images/banner2.jpg" width="507" height="150" /></td> </tr> </table> <body onload="scrollMe('news')"> <div class="center2" id="news"> <table width="1024" border="0"> <tr> <td width="507"><img src="images/newstemplate_l.jpg" width="506" height="100" /></td> <td width="507"><img src="newstemplate_r.jpg" width="506" height="100" /></td> </tr> <tr> <td><img src="images/newstemplate_l.jpg" alt="" width="506" height="100" /></td> <td><img src="newstemplate_r.jpg" alt="" width="506" height="100" /></td> </tr> <tr> <td><img src="images/newstemplate_l.jpg" alt="" width="506" height="100" /></td> <td><img src="newstemplate_r.jpg" alt="" width="506" height="100" /></td> </tr> <tr> <td><img src="images/newstemplate_l.jpg" alt="" width="506" height="100" /></td> <td><img src="newstemplate_r.jpg" alt="" width="506" height="100" /></td> </tr> <tr> <td><img src="images/newstemplate_l.jpg" alt="" width="506" height="100" /></td> <td><img src="newstemplate_r.jpg" alt="" width="506" height="100" /></td> </tr> <tr> <td><img src="images/newstemplate_l.jpg" alt="" width="506" height="100" /></td> <td><img src="newstemplate_r.jpg" alt="" width="506" height="100" /></td> </tr> <tr> <td><img src="images/newstemplate_l.jpg" alt="" width="506" height="100" /></td> <td><img src="newstemplate_r.jpg" alt="" width="506" height="100" /></td> </tr> </table> </div> </div> </body> </html> Hi, I have a JS that can run on IE but cannot on FireFox and Safari. The script like this: Code: function DeleteClick() { var frmSWO = document.getElementById("form"); var answer = confirm("Do you really want to delete?") if (answer != 0) { frmSWO.action = "/domsWeb/controller/manageWorkOrder/DeleteJobOrImage.do"; frmSWO.method = "post"; this.form.fireEvent('onsubmit'); frmSWO.submit(); } } So after I change the script, it now can work on Safari and Firefox but cannot on IE. The script is below: Code: function DeleteClick() { var frmSWO = document.getElementById("form"); var answer = confirm("Do you really want to delete?") if (answer != 0) { frmSWO.action = "/domsWeb/controller/manageWorkOrder/DeleteJobOrImage.do"; frmSWO.method = "post"; if(frmSWO.fireEvent) { frmSWO.fireEvent('onsubmit'); //'this.form' might be not clear enough } else { frmSWO.submit(); //fireEvent may not be neccessary since submit() is also called } } } This is really troublesome! Please help me to amend the script for it to be able to work on all 3 browsers. Appreciate any help. Hi, I have an Issue with a Javascript slideshow. If you see link below it is obvious http://scriptdemo.co.uk/davidgray/al...tes/index.html please can you advise? I only get the Issue in Internet Explorer 8 many thanks Joe Not sure if I'm in the right category, apologies if I am not.. I have a small flash/javascript streaming mp3 player on my site that works fine in Chrome and Safari, but doesn't show up at all in Firefox, IE, or Opera. the site is he www.thehordeandtheharem.com/index2.html the player is in the top left corner. I don't even know where to begin troubleshooting this as I didn't write the player myself, but copied it from another site. If anyone could shed any light on this for me I would be very grateful, thanks! Take a look at this - http://s385506566.websitehome.co.uk/ If it is ran in either chrome or safari it acts as it should (the sub menus open below the nav bar) but in IE and Firefox it is very different and a problem (the sub menus open Above! the nav bar) Any Ideas? I have the following code to display an image (and link if there is one): Code: if (ads[adNumber].href) { tempCode += ('<a href="'+ ads[adNumber].href +'" target=_blank "> \n') tempCode += ('<img src="' + ads[adNumber].src + '" width=' + ads[adNumber].width) tempCode += (' onLoad="setTimeout(\'newAd();\',' + refreshTime + ');"') tempCode += ('\n height=' + ads[adNumber].height + ' border=0 >') tempCode += ('</a>') } else { tempCode += ('<img src="' + ads[adNumber].src + '" width=' + ads[adNumber].width) tempCode += (' onLoad="setTimeout(\'newAd();\',' + refreshTime + ');"') tempCode += ('\n height=' + ads[adNumber].height + ' border=0 >') } return tempCode; This works OK in IE9 but only shows the image if there is no link in IE7 (that is, if (ads[adNumber].href) is not true). Thanks for any help! Hey, everyone: I've been having some trouble with javascript in different browsers. I developed my website using Safari and Chrome on a Mac, only to now realize that some of my javascript will NOT function in FireFox and IE (for both Mac and Windows). I understand that each browser has its quirks, but I'm not aware of anything that would cause my code to act so strangely. The biggest problem seems to be my onload() call in the body tag. I'm definitely an amateur, so forgive me if my work is not professional. Here's the JS in the head: Code: <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=8" /> <title>Wave Shark | Compose, Store, and Share Workouts</title> <script type="text/javascript">//<![CDATA[ function toggle(e) { if (e.style.display == "none") { e.style.display = ""; } else { e.style.display = "none"; } } //]]> </script> <script type="text/javascript">//<![CDATA[ var domainroot="#" function Gsitesearch(curobj) { curobj.q.value="site:"+domainroot+" "+curobj.qfront.value } //]]> </script> <link href="cssFiles/style.css" rel="stylesheet" type="text/css" media="screen" /> <link rel="shortcut icon" href="../cssFiles/images/img04.jpg" type="image/x-icon" /> <script src="incFunctions/functions.js" type="text/javascript"> </script> </head> And in the body tag: Code: <body oncontextmenu="return false;" onload="toggle(progress)"> <div id="progress" style="text-align:center;width:100%"><strong style="font-size:14pt;color:#0000DD;font-family:"arial,helvetica,sans-serif">Loading...</strong></div> In addition to that, you can check out: http://waveshark.elementfx.com/incFu...s/functions.js Any and all suggestions are appreciated. |