Calling of parent value along with another page form id

Joined
Aug 1, 2023
Messages
1
Reaction score
0
Function MFRDTL_onclick()
Parent.MAIN2.xxx.STYLE.display=""
Parent.MAIN2.FIRST.STYLE.display="none"
Parent.MAIN2.Document.ENTRY1.PAGECODE.value="7"
Parent.MAIN2.Document.ENTRY1.SUBMITVALUES.value="Continue.For MANUFACTURER DETAILS"
End Function

this is in vb script i want to write this function in javascript. Main2 is previous page frame name. and Entry1 is an parent page form id. but in javascript parent value is getting null. kindly help me out
 
Joined
Jul 4, 2023
Messages
366
Reaction score
41
In javascript use lowercase letters in object names

Parent => parent
Document => document
Document => document.body

try use e.g.

JavaScript:
var parent = document.querySelector('[name="MAIN2"]');
for
HTML:
<iframe name="MAIN2">...</iframe>

JavaScript:
var parent = document.querySelector('#MAIN2');
for
HTML:
<iframe id="MAIN2">...</iframe>

JavaScript:
// Parent.MAIN2.Document.ENTRY1.PAGECODE.value="7"
//Parent.MAIN2.Document.ENTRY1.SUBMITVALUES.value="Continue.For MANUFACTURER DETAILS"

var parent = document.querySelector('#MAIN2');
/*
  <form id="ENTRY1">
    // ...
    <input id="PAGECODE" ...>
    <input id="SUBMITVALUES ...>
  </form>
*/
parent.document.querySelector('#ENTRY1 #PAGECODE').value = '7'; // I'm guessing: <input id="PAGECODE">
parent.document.querySelector('#ENTRY1 #SUBMITVALUES').value = 'Continue.For MANUFACTURER DETAILS'; //  I'm guessing: <input id="SUBMITVALUES">
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top