/    Sign up×
Community /Pin to ProfileBookmark

Links toolbar translator

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:

[code=php]<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>[/code]

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

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@gil_davisNov 19.2003 — 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.
Copy linkTweet thisAlerts:
@neil9999authorNov 20.2003 — 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
Copy linkTweet thisAlerts:
@gil_davisNov 20.2003 — 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.
Copy linkTweet thisAlerts:
@neil9999authorNov 20.2003 — 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
×

Success!

Help @neil9999 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...