Click to See Complete Forum and Search --> : Links toolbar translator


neil9999
11-19-2003, 01:24 PM
Hi,

I've got the following code as the URL of a button in the links toolbar:

javascript:window.open("http://www.mysite.co.uk/translator4linkstoolbar.htm",null,"height=200, width=500 status=yes top=200");window.location=location.href; //URL not real - for demo only

on translator4linkstoolbar.htm, i have this code:

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>

<body onload="document.getElementById('box2').value=window.opener.location.href">

<form name=" box">

<p><select name="lg" id=lg>
<option value="en_zh">English to Chinese</option>
<option value="en_fr">English to French</option>
<option value="en_de" SELECTED>English to German</option>
<option value="en_it">English to Italian</option>
<option value="en_ja">English to Japanese</option>
<option value="en_ko">English to Korean</option>
<option value="en_pt">English to Portuguese</option>
<option value="en_es">English to Spanish</option>
<option value="zh_en">Chinese to English</option>
<option value="fr_en">French to English</option>
<option value="fr_de">French to German</option>
<option value="de_en">German to English</option>
<option value="de_fr">German to French</option>
<option value="it_en">Italian to English</option>
<option value="ja_en">Japanese to English</option>
<option value="ko_en">Korean to English</option>
<option value="pt_en">Portuguese to English</option>
<option value="ru_en">Russian to English</option>
<option value="es_en">Spanish to English</option>
</select></p>
<input type="text" name="box2" size="20" id=box2></p>
<button onclick="window.location='http://babelfish.altavista.com/babelfish/tr?doit=done&urltext='+document.getElementById('box2').value+'&lp='+document.getElementById('lg').value+''">
translate</button>

</form>


</body>

</html>

When you click on the button on the links toolbar, a popup appears with translator4linkstoolbar.htm in. In the textbox should appear the address of the page that opened it. One prob - it doesn't. Does anyone know why this is happening?

Thanks in advance,

Neil

gil davis
11-19-2003, 04:16 PM
I believe that window.location will not take a search string, because that would not be a "proper" URL. You should be able to add the other stuff into window.location.search and then replace the URL (as soon as you set the location, your page is replaced, and the script dies).

If that does not help, then you are probably suffering from cross-domain security issues.

neil9999
11-20-2003, 11:22 AM
Thanks for your help. It works absolutely fine if you just type a URL into the box, what i need is for the URL of the page you were on to automaticly be put into the textbox.

Eg. you are on javascript.internet.com. You click on the translate button. In the textbox in the popup that appears should appear http://javascript.internet.com.

Thanks again,

Neil

gil davis
11-20-2003, 01:38 PM
Apparently I misunderstood the problem. I was too interested in trying to figure out what the SELECT box was supposed to do. Why don't you try to describe your problem a bit differently.

For one thing, I don't know what a "links toolbar" is.

neil9999
11-20-2003, 03:40 PM
The "links toolbar" is a toolbar in your internet browser which has loads of buttons on, each which goes to a differentt website which you can specify. Are you using the English/american version of IE? The select box in the popup is used to select the language. Basically, I'm creating a translator in this popup. Say you are on google.com. You click on the button in the links toolbar. The popup appears. The textbox SHOULD appear with "http://www.google.com" in. This is the only thing that doesn't happen/work. Everything else, including the SELECT box, works perfectly. You select the language to translate from/to and click the "translate" button. This all works fine. In the popup appears the translated page.

Hope you understand my problem,

Thanks,

Neil