I have a problem with my code. I want to change the iframe url when the submit button is clicked, but it isn’t working. I have found some questions about this, and I found GoToGoogle function where it must forward to google. So that’s all of my code for the page.
<script>
function sendMeToGoogle(){
document.getElementId('changeme').src="http://google.com/";
}
</script>
this is test
<iframe src="test" ID="changeme" ></iframe>
<input type="submit" onclick="sendMeToGoogle();" />
Can someone help me?
Your problem is that you are not calling the right Javascript function. You should be calling
document.getElementByIdbut instead you are callingdocument.getElementIdwhich doesn’t exist.