/    Sign up×
Community /Pin to ProfileBookmark

Want to populate message in other site’s text box

Hi,

What I have:
I have a link on one site say “click me” (which is my own code)

What I want:
when user click on this link : a new site will open in a window
I want to populate a message in this site’s text box (this site is any general site[which is not my code])

What I tryied:

temp1.html
……………

<html>
<head>
<script language=”javascript”>
function openWindow(){
var newWin = window.open(“temp2.html”, “newWin”);
alert(“success”);
newWin.document.getElementById(“fName”).value=document.getElementById(“txt1”).value;

}
</script>

</head>
<body>
<input type=”text” name=”txt” id=”txt1″/>
<a href=”#” target=”_blank” onClick=”javascript:openWindow(); return false;”>Click Me</a>
</body>
</html>

temp2.html
…………….
<html>
<body>
<form name=”myForm” method=”post”>
<input type=”text” name=”firstName” id=”fName” value=”Juyal” />
<input name=”ln” type=”text” name=”lastName” id=”lName” />
</form>
</body>
</html>

Result: this is working fine
……………………………………………………….

My Problem:

But when I am using any othe general site[which is not my code]) it do not work.

Can you please provide me the modified code, which can work for any site.

Thanks
Happy Java.

to post a comment
Full-stack Developer

3 Comments(s)

Copy linkTweet thisAlerts:
@KDLAMay 09.2008 — This will not work because you are not referencing the form and/or textbox in the second "site."

Also, it's impossible to retain a variable (through client side scripting) once you've left your site and entered another.

KDLA
Copy linkTweet thisAlerts:
@happyjavaauthorMay 13.2008 — Thanks for instant reply but not a satisfied. There must be some solution. Looking for some solution.
Copy linkTweet thisAlerts:
@ray326May 13.2008 — Define "it do not work." There are an infinite number of ways it can fail to work. Use Firebug's console to see if any errors are being generated in temp1.html.
×

Success!

Help @happyjava 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 4.28,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...