wood burning stoves 2.0*
The moose likes HTML, CSS and JavaScript and the fly likes Want to populate text box of other sites from my code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Want to populate text box of other sites from my code" Watch "Want to populate text box of other sites from my code" New topic

Want to populate text box of other sites from my code

Kishan kant

Joined: May 13, 2008
Posts: 4

I have a link on myweb page[mycode] which open another site [Which is not my code].
I want to populate the textbox of second site with some message whenever a user click on link of mysite.

what I tried:
1. Reguest parameter
window opan("http://www.anotherDomain.com?firstname="+fName+"&lastName="+lName,"_newWin");}

Resut: Not working



script language="javascript"
function openWindow(){
var newWin = window opan("http://www.anotherDomain.com", "newWin");
newWin.document getElementBiId("fName") value=document getElementBiId("txt1") value;

input type="text" name="txt" id="txt1"/
a href="#" target="_blank" on_Click="javascriptopenWindow(); return false;" Click Me /a

Result: Not working

3. Using ajax, modify the response and rewrite in new window
Result: message is populating but URL is gone from address bar.

What I want ?
Solution Code! using JAVA,Servlet,JSP,javascript or AJAX

What I don't want?: 'Not possible'

Thanks and Regards,
Happy Java
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

"happy java ",
Welcome to the JavaRanch.

We're a friendly group, but we do require members to have valid display names.

Display names must be two words: your first name, a space, then your last name. Fictitious names are not allowed.

Please edit your profile and correct your display name since accounts with invalid display names get deleted.
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15376
JavaScript has a same domain policy. If the webpage is in a different domain, it is not going to work. Only way to populate the data is to have the other site take the querystring parameter and handle it.

I agree. Here's the link: http://aspose.com/file-tools
subject: Want to populate text box of other sites from my code
Similar Threads
Return string from javascript function and display in text area.
How to close the popup window automatically after download completes
URGENT: Please advise
Struts 2 / Tiles / Tiny MCE
Problem in AJAX and JSP data exchange