Jump to content
worm32....

Ajutor js

Recommended Posts

Posted

Cum schimb un value dintrun textbox dintr-o ferestra separata folosind js?

Am incercat cu:


var f=window.open('test.html');
f.document.getElementById('name').value='asd';

Dar primesc urmatoarea eroare

[15:23:06.899] Empty string passed to getElementById().
[15:23:07.309] TypeError: f.document.getElementById(...) is null @

Posted

Sa-ti explic logica a ce ai dat tu:

1. Deschid Fereastra noua

2. Modific

3. Fereastra s-a incarcat

Mai exact, inainte de toate asteapta sa se incarce fereastra. Pentru asta poti folosii event-ul onload.


var f=window.open('test.html', 'vierme', 'width=100, height=100');
f.onload = function(){
this.document.getElementById('name').value='asd';
}

Si apropo, sper ca stii ca ambele pagini trebuie sa iti apartina.

Posted

Mai întâi de toate trebuie s? te asiguri c? pagina a fost înc?rcat?, ?i abia apoi execu?ii func?ia. Exemplu:

var f = window.open('test.html');
f.onload = function () {
f.document.getElementById('name').value = 'asd';
};

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...