Click here to Skip to main content
15,902,276 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My code is:

"<iframe id="www" name="www" src="about:blank"></iframe>

<script>
function myFunction(){
var userInput = prompt("Enter URL","");
if(userInput !=null && userInput !=""){document.getElementByID('www').src=userInput;}}
myFunction();
</script>"

The src won't change. Please can you explain what I'm doing wrong?
Posted

1 solution

javascript is case sensitive and cases in your "getElementByID" are not proper that's why code is not working. Please try below

document.getElementById('www').src=userInput;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900