JS implements the method of loading different web pages within the frame after clicking the button
- 2020-06-07 03:57:45
- OfStack
This article illustrates how JS can load different web pages within the frame after clicking a button. Share to everybody for everybody reference. Specific implementation methods are as follows:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title> Headless document </title>
</head>
<body>
<script type="text/javascript" src="jquery-1.6.2.min.js"></script>
<iframe width="1024" height="768" id="Box" frameborder="1"
scrolling="0"></iframe>
<br />
<script language="javascript">
function GetUrl()
{
try
{
$("#Box").attr("src","https://www.ofstack.com/");
}
catch(e)
{
window.location.reload();
}
}
</script>
<input id="CmdGetUrl" type="button" value=" Loading page " onclick="GetUrl()"/>
</body>
</html>
Hopefully, this article has been helpful in your javascript programming.