1

I have this very simple Javascript to write on a text area when the link is clicked:

<head>
<script language="javascript" type="text/javascript">
    function addtext(text) {document.form.textarea.value = document.form.textarea.value+= text;}
    </script>
</head>

<body>
<form action="" method="" name="form">
   <textarea name="textarea" rows="" cols="" wrap="wrap"></textarea>
</form>
<a href="javascript:addtext('q');">q</a>
</body>

Now I want to up the ante.

What I want to do is have the form in another another window, and that when I click the link, I writes to a textarea in another window.

I'm not necessarily asking for the code because I realize this might be quite complicated.

The question would be where to start, because I haven´t got a clue!! (when I Google cross window or cross domain interaction with Javascript I don't really get anything useful).

So any help I can get, libraries, plugins or whatever might guide me in the right direction is more than appreciated.

Trufa
  • 39,971
  • 43
  • 126
  • 190

3 Answers3

6

Ok, I wrote you a sample you can check at http://jsfiddle.net/zzdAL/

$(document).ready(function()
                  {
                      popup = window.open("http://fiddle.jshell.net");
                      $("#input1").click(function() {
                          try {
                                popup.document.window.alert(1);
                          }
                          catch (e) { alert(e.message); }
                      });
                  }
                 );

It only runs an alert on the popup, but you can do whatever you want with the popup, assuming you have the necessary rights (needs to be the same domain I believe).

The most simple is to write a function in your popup and call it from the opener.

GôTô
  • 7,974
  • 3
  • 32
  • 43
  • That is awesome!! Thank yo so much!! BTW If you can think of any documentation that can come in handy, it would be appreciated, thanks again, great help! – Trufa Oct 16 '10 at 20:57
0

Probably it's too late, but here is an example of interaction: window interaction

dy_
  • 6,462
  • 5
  • 24
  • 30
-1

Take a look to greasemonkey, it's an addon for your browser. You can choose on which page(s) the script will works.

http://wiki.greasespot.net/Main_Page

Gilles Quénot
  • 173,512
  • 41
  • 224
  • 223