I have SAP system where I can integrate HTML page. This HTML page is launched on Button Click.
Button click changes the value of Iframe source every time. As I understand the basic, I wrote the below code which is working fine on the first click. The HTML page gets loaded.
<!DOCTYPE html> <html> <body onLoad="myFunction()"> <iframe id="myFrame" src="http://www.w3schools.com/" height="1000" width="2000" frameborder="0"></iframe> <script> function myFunction() { document.getElementById("myFrame").src = sap.byd.ui.mashup.context.inport.FirstName; } </script> </body> </html> When I click second time the value for sap.byd.ui.mashup.context.inport.FirstName changes, but there is no change in the Iframe.
I saw there is something called onChange event, but I am not able to write use it correctly. Can anyone help me to do this?
body onloadwhich would only run once.srcof theiframeismyFunction(). And that gets called onbody onload, which would only run once for an html page. Once you assing the value ofsap.byd.ui.mashup.context.inport.FirstNametoiframe.src, changingFirstNamewill not effectiframe.src; You need to callmyFunction()again after changingFirstnameto changeiframe.src