Find Code For Translator?
Jun 6, 2009I am in the process of creating a website and I want to include a translator and I do not know where to find the code for such a thing.
View 2 RepliesI am in the process of creating a website and I want to include a translator and I do not know where to find the code for such a thing.
View 2 RepliesI'm a novice in javascript programming. I need to create a program that automatically sends websites to a free translating site (the part where it asks you to input a url for website translation), and automatically redirect the user to the translated site. I basically just need to know how to send the url to that box, and submit the result, and redirect the user there.
View 2 Replies View RelatedDon't know if there is one of these online, so I made me own. Simple function that outputs a number as words. First argument is the number, second argument is flag (default = false) that controls whether output is cardinal or ordinal - as in "one" or "first".
Goodness knows if I have the grammer correct, especially when the numbers get big. Enjoy!
LIMITS:
1) Doesn't work with WebTV or below NS 4. Changing the large literal array into a common array should fix that, but I didn't bother.
2) Converts number into an integer before wording number. So, no "one point forty-five" stuff. This function is a good start for anyone who wants to do that though.
3) Always returns, "zero" for 0. Couldn't find cardinal equivalent to "zero"... zeroeth?
/*
Num2Word, ouputs written number in human language format
ARGUMENTS:
-----------
Nbr: num, the number to be worded. This number is converted into an integer.
Crd: bol, flags whether output is cardinal or ordinal number. Cardinal is used when describing the order of items, like "first" or "second" place.
*/
function Num2Word(num,fmt) {
//_ arguments
num = Math.round(num).toString(); // round value
if (num == 0) return 'zero' // if number given is 0, return and exit
//_ locals
// word numbers
var wnums = [['hundred','thousand','million','billion','trillion','zillion'],['one','first','ten','','th'],['two','second','twen',0,0],['three','third','thir',0,0],['four','fourth',0,0,0],['five','fifth','fif',0,0],['six','sixth',0,0,0],['seven','seventh',0,0,0],['eight','eighth','eigh',0,0],['nine','ninth',0,0,0],['ten',],['eleven',],['twelve','twelfth'],['thirteen',],['fourteen',],['fifteen',],['sixteen',],['seventeen',],['eighteen',],['nineteen',]];
// digits outside triplets
var dot = (num.length % 3) ? num.length % 3 : 3;
// number of triplets in number
var sets = Math.ceil(num.length/3);
// result string, word as number
var rslt = ''
//_ convert every three digits
for (var i = 0; i < sets; i++) { // for each set of triplets
// capture set of numbers up to three digits
var subt = num.substring((!i) ? 0 : dot + (i - 1) * 3,(!i) ? dot : dot + i * 3);
if (subt != 0) { // if value of set is not 0...
var hdec = (subt.length > 2) ? subt.charAt(0) : 0; // get hundreds digit
var ddec = subt.substring(Math.max(subt.length - 2,0),subt.length); // get double digits
var odec = subt.charAt(subt.length - 1); // get one's digit
// hundreds digit
if (hdec != 0) rslt += ' ' + wnums[hdec][0] + '-hundred ' + ((fmt && ddec == 0) ? 'th' : '');
// add double digit
if (ddec < 20 && 9 < ddec) { // if less than 20...
// add double digit word
rslt += ' ' + ((fmt) ? ((wnums[ddec][1]) ? wnums[ddec][1] : wnums[ddec][0] + 'th') : wnums[ddec][0]);
} else { // otherwise, add words for each digit...
// add "and" for last set without a tens digits
if ((0 < hdec || 1 < sets) && i + 1 == sets && 0 < ddec && ddec < 10) rslt += 'and '
// tens digit
if (19 < ddec) rslt += wnums[ddec.charAt(0)][(wnums[ddec.charAt(0)][2]) ? 2 : 0] + ((i + 1 == sets && odec == 0 && fmt) ? 'tieth' : 'ty') + ((0 < odec) ? '-' : ' ');
// one's digit
if (0 < odec) rslt += wnums[odec][(i + 1 == sets && fmt) ? 1 : 0];
}
// add place for set
if (i + 1 < sets) rslt += ' ' + wnums[0][sets - i - 1] + ' ' // if not last set, add place
} else if (i + 1 == sets && fmt) { // otherwise, if this set is zero, is the last set of the loop, and the format (fmt) is cardinal
rslt += 'th' // add cardinal "th"
}
}
//_ return result
return rslt
}
Test the result of various valies like so
for (var i = 0; i < 50; i++) {
var x = Math.round(Math.random() * 5000000);
document.write(x,' -> ' + Num2Word(x).bold(),'<BR>');
}
Use this function towards whatever means you deem necessary. Pease credit me, Bemi Faison, if you use this script.
I have developed my own fake language like pig latin but ever so slightly different, I want to make a translator for it as there are so many for pig latin,english-my language:
1: put the first letter at the end (hello becomes elloh)
2: put an 'a' 2 letters in (elloh becomes elaloh)
obviously if the inputted word had a capital letter at the begining, then the new first letter should be in capitals, and the translator should be able to translate whole sentences not just word by word,I have downloaded countless javascript/html files for pig latin translating because obviously the first step for translating to the 2 languages is the same and ive managed to stop it adding the 'ay' or 'way' to the end of the word as it is in pig latin bu i dont think ive done it very efficiently?
Imagine the following input:
Code:
<form action="search.php" method="get">
Search: <input type="text" name="search" />
<input type="hidden" name="searchOriginal" value="search" />
[code].....
What I would like to do is: Use google AJAX API to see if the search string (search) is different of english. I would like to translate it and send it like that to search.php. So it would appear already translated like this in the URL: search.php?search=translatedString. And search.php would also see it translated.
PHP Code:
if (navigator.userAgent.toLowerCase().indexOf('msie 6')!=-1){
$("#pdfPopup img[@src$=png]").pngfix();
$("#pdfPopup .sidebar ul").css({
background: "none",
filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+urlRoot+"/images/BKGmodelsBox_grad.png', sizingMethod='scale')"
[Code]...
This is a part of the larger .js code. It fixes .PNG images problem specific to IE6. Everything works fine in Firefox, Opera, IE6 and Chrome. The problem appears only in IE7 and IE8. JavaScript stops executing somewhere after the second line, and the browser reports an error in .js file on that line.
When a webpage is calling a javascript function within the <body> </body> tags, is there a quick way to find the code for that paticular javascript function without having to manually search through every external script. I don't have access to the server so I need to find the code for the javascript function from the front end. If it helps you I am using firefox with firebug I also have the web developer toolbar installed.
View 2 Replies View RelatedI found Google Transliteration, a very good tool to reproduce the sounds of a sentence in a different language.
Reference:
[URL]
It supports approx. 22 languages. how does make it to support German and Swedish too. I cant see these languages there.
When the tabs are initialized by this code:$( "#tabs" ).tabs(); , it displays the tabs in a way that I don't like. I want to trace into the actual 'tabs' function when this is called so I can see why it is doing what it is doing. I have not been able to find where this code is sitting.
View 2 Replies View RelatedI am having some difficulty in constructing a window.confirm() function that works with my code.So if the form data is valid, I need to use a window.confirm() dialog box to show the user's total cost based on the rental rate of equipment chosen and the reservation period. The user must accept the cost by pressing the confirm button, and if user cancels do not submit data.I have written this code but cannot figure out how to find the number of days from the 2 date fields and use that to calculate and display the total cost.
//confirm submit and display rental cost
var equip = document.forms[0].equipment.value
var pDate = document.forms[0].pickupDate.value[code].....
<div>
Is it possible find a node backwards instead of forwards.
I would like to do (remember find_reverse does not exist)
here is the page I'm working onhere is the jQuery in use
$(document).ready(function() { $('.error,.success').hide(); $("#send").click(function (){ $('.error,.success').hide("slow"); $.ajax({ url: 'add.php?lnk='+$.URLEncode($('[name=lnk]').val())+'&
[code]....
and in this code, it works, the call is made and text is added. in the other code I don't get a change at all. Not even in the database that add.php manipulates.
I am trying to make a gui for clients to edit a php page that displays html and javascript.
I want the user to be able to move html elements around and even edit it like add effects like fade in and out etc.
Then after all the changes I want to overwrite the existing php file that does this for that user. how can you make such changes and then save it to a file?
It's an html / javascript editor but using a gui instead of allowing them to directly touch the code. It would be a security risk if I allow such a thing. So I need to program a interface that would make such changes and save them to file.
Like how can you delete and add new javascript code to the file?
I am a novice, almost to an intermediate-level JavaScript guy, so much of this is new to me. I appreciate your patience reading this.
I have a routine that creates some HTML on the fly (updateFilters() function) and after the HTML is created, I attempt to access some fields (elements) on the form itself.
I works fine if I place an alert() statement after the HTML is created, but when I remove, the code errors out.
I have tried the setTimeout() statement, but I cannot grab the element --- undefined or null is returned. It seems that the form is the only element I can get a handle on --- everything else is undefined or null...
Here is the code:
function editQuery() {
var f;
var x;
var myForm = document.forms[0];
// Get the row filters that were used in the last query..
for (f = 1; f < 16; f++) {
var filter = eval("myForm.FilterList_" + f);
if (filter.selectedIndex > 0) {
var methodElement = element("FilterMethod_" + f);
var methodIndex = methodElement.selectedIndex;
var savedFilterMethodValue = methodElement.options[methodIndex].text;
var choicesElement = element("FilterChoices_" + f);
var choicesIndex = choicesElement.selectedIndex;
if (isNaN(choicesIndex)) {
var savedFitlerValues = choicesElement.value;
}
else {
var savedFitlerValues = choicesElement.options[choicesIndex].text;
}
updateFilters(filter); // update the filters
// take the saved methods and values and then update the selections
// Alert here makes the code work..
// alert("Try this");
// Wait for HTML..
setTimeout("completeEdit()", 1000);
function completeEdit() {
// Since the object was updated, get the object again..
var methodElement = element("FilterMethod_" + f);
for (x = 0; x < methodElement.options.length; x++) {
if (methodElement.options[x].text == savedFilterMethodValue) {
methodElement.options[x].selected = true;
break;
}
else {
methodElement.options[x].selected = false;
}
}
// Since the object was updated, get the object again..
var choicesElement = element("FilterChoices_" + f);
for (x = 0; x < choicesElement.options.length; x++) {
if (choicesElement.options[x].text == savedFitlerValues) {
choicesElement.options[x].selected = true;
break;
}
else {
choicesElement.options[x].selected = false;
}
}
// Only display next row if f = 2..
// If only one row was used, no reason display the next row..
if (f == 2) {
displayNextFilter(f - 1); // display it
}
}
clearTimeout(timeOut);
}
}
}
Do I have to pass the object (the form, the elements) to the completeEdit() function in the setTimeout() statement?
I am trying to hide this code:
HTML Code:
using this code
HTML Code:
This works fine when I place this code under the html in the main source, but if I try to add this Jquery code to an external js sheet it doesnt seem to work?
Currently my js sheet is called in the header, when I move this link to the footer of my page the code works again, so Im guessing this has something to do with where the jquery code is placed in relation to the code Im trying to hide?
How I can keep my js in the header but still make the content disappear on click?
I'm trying to get my Client Side Firefox DHTML app to display a list of eBooks. For this, i have the following files
F:Textbooks.html
F:eBooks.txt
F:FirstBook.txt
F:SecondBook.txt
F:ThirdBook.txt
[Code].....
i'm using FireFox 3.5 to develop this App. So obviously this will not work with anything other than Gecko Based browsers.
here is my HTML code:
<html>
<head>
<script language="JavaScript">
var eBookLibrary = "eBooks.txt";
[Code]....
I am VERY NEW to javascript programming as I am to web development. I am pretty decent with VB.Net though. My question is, what are the different ways to call a JavaScript Function either from within XHTML Markup code or from a VB.Net Code-Behind file?
View 3 Replies View RelatedThe .find() method does not seem to match on input fields by using a class. The ti This problem seems to be only visible on input fields. The following is a demonstration of the issue:
Example at [url]
The code executes nicely in the site and the pictures/text show up where and how they should - It's just that I'm also getting some code as a slide!
In the <head> I have:
<script type="text/javascript">
$.fn.cycle.defaults.timeout = 8000;
$(function() {
$('#contentLeft pre code').each(function() {
[Code].....
I can not this code in my web page. Could you please check it ans say how I can run. I try the code using html test page but failed.
<script language="javascript"><!--
document.write('<iframe src="http://www.juenpetmarket.com/moduls/banner/banner_reklamiframe.aspx?
[code]....
After realizing that htc files only work with Internet Explorer, I have needed to have JavaScript code to suit the two lots of css code below. Please help, I need the code pretty urgently. The code must work with most versions of browsers.
[Code]...
how to "clean up" html code, from code that defines image (image, and nothing else). I have string like:
Code HTML4Strict: This is my <b>code</b>. <img src="img/1.jpg" /><br />This is line number two.The result shoud be:
Code HTML4Strict: This is my <b>code</b>. <br />This is line number two.
I hope whether such a script exists for what am wanting to do. From time to time, I need to send password information or login details and password information to some users. At the moment, am doing it via email with a subject named FYI and the body of the email basically just contain the login and the password or in some case, just the password. What am wanting to know is whether I can put these information into a HTML file which contains an obfuscated Javascript with a button that a user will click that will prompt for his login information and then will display the password. In its simplest form, I guess I am looking for a Javascript that will obfuscate a HTML file that contains the password. I found some website that offers such service as obfuscating a HTML file but am hoping it can be done via a Javascript so it is at least "portable" and I do not have to be online.
View 5 Replies View RelatedI am about to port an app using html, css, and javascript where most of the content is mixed with the presentation and behaviour.
The question I have been asked is: even though this older style is difficult to maintain, will the method proposed my the authors of Simply Javascript perform adequately on a page with hundreds of entries like the one below? Using the newer method, the program would have to iterate through all the elements on the page and assign handlers for click, mouseover, etc. Please advise. Code:
I want to add few lines for content, which is already present, using Javascript.
HTML code :
<html>
<head>
<script type="text/javascript">
function test()
[Code]....
If image is grater than 300px width then below line should be appeared otherwise no.
<p><a href="image1.gif"><img href="zoom.gif" /></a></p>
With above script i reached upto half part.
How do I write a CSS related code into a Web page from Javascript code?
That is for example if the Javascript code detects certain condition, then I want it to output a certain CSS code into that page. How is this done?