0

My Form1.jsp has iframe

<iframe id="results" name="results" style="display: none;"  
width="100%" height="240" frameborder="1"></iframe>

I want to access iframe id in javascript function in My form2.jsp

function Hide() {
  if(document.getElementById("results").style.display=="none")  {
    document.getElementById("results").style.display="block";
  }
}

in the place results string I want to access iframe id from Form1.jsp

mplungjan
  • 169,008
  • 28
  • 173
  • 236
Manasa J
  • 11
  • 6
  • And what is the result? Any console errors? Where is form2? In the iFrame? Can you post more HTML? Also you call the function hide but it should show. Also you may want to set the style by script so the test works - try `console.log(document.getElementById("results").style.display)` to see it is likely not "none" when you expect it to be - read here: http://stackoverflow.com/questions/4866229/can-you-check-an-objects-css-display-with-javascript – mplungjan Nov 28 '16 at 07:06
  • the javascript function Hide() in form2.jsp i want to access the iframe id in form1.jsp throught javascript Hide() in form2.jsp – Manasa J Nov 28 '16 at 07:12
  • http://stackoverflow.com/questions/23286619/how-to-pass-the-values-from-one-jsp-page-to-another-jsp-without-submit-button – Mahi Nov 28 '16 at 07:13
  • Please show the HTML with both forms – mplungjan Nov 28 '16 at 07:32

1 Answers1

0

Try this.

  1. redirect from Myform1.jsp to Myform2.jsp using jsp redirect method

public void response.sendRedirect("Myform2.jsp/?formid=id") throws IOException

add it in form1.jsp.

id = your id, you want to send.

  1. In form2.jsp, Read the Url and get the query.
hari prasad
  • 75
  • 1
  • 10