本文介绍了HTML / javascript - 制作webbrowser的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 这是我的代码 < html > < 表格 名称 = form1 方法 = 发布 action = > < label = 乌尔ls > < / label > < 输入 类型 = 提交 名称 = 返回 id = 返回 value = < önClick = myIframe.history.back() > < 输入 type = submit 名称 = 转发 id = forward value = > onClick = myIframe.history.forward() > < input type = 提交 name = 搜索 id = 搜索 value = Go onClick = LoadPage() > < 输入 type = text 名称 = urls id = 网址 value = http: // > < / form > < iframe src = http://www.google.com width = 500 height = 400 frameborder = 0 id = myIframe > < / iframe > < script language = javascript > function LoadPage(){ var objFrame = document .getElementById( myIframe); objFrame.src = document .getElementById( URL)值。 } < / 脚本 > < / html > 我似乎无法找到这个代码的问题,它在Dreamweaver中工作,但一旦它保存,我文档点击它,在我的chrome broswer运行它,它不工作?有人可以解释一下吗?解决方案 你错过了< head>和< body>大多数浏览器认为这些部分对于格式良好的HTML文档至关重要。您还应该将您的Javascript代码放在< head>中部分,除非你有特别的理由将它放在页面上。 < html> < head> < title>我的网页< / title > < script language = 的JavaScript> function LoadPage(){ var objFrame = document .getElementById( myIframe); objFrame.src = document .getElementById( URL)值。 } < / script> < / head > < body> < form name = form1 method = post action = > < label for = urls > < / label > < input type = submit name = back id = back value = < onClick = myIframe.history.back()> < input type = submit name = forward id = forward value = > onClick = myIframe.history.forward()> < input type = submit name = 搜索 id = 搜索 value = Go onClick = LoadPage()> < input type = text name = urls id = 网址 value = http://> < / 表格 > < iframe src = http://www.google.com width = 500 height = 400 frameborder = 0 id = myIframe> < / iframe > < / body > < / html > this is my code<html><form name="form1" method="post" action=""> <label for="urls"></label> <input type="submit" name="back" id="back" value="<" önClick="myIframe.history.back()"> <input type="submit" name="forward" id="forward" value=">" onClick="myIframe.history.forward()"><input type="submit" name="Search" id="Search" value="Go" onClick="LoadPage()"> <input type="text" name="urls" id="URL" value="http://"></form><iframe src="http://www.google.com" width="500" height="400 frameborder="0" id="myIframe"></iframe> <script language="javascript"> function LoadPage(){ var objFrame=document.getElementById("myIframe"); objFrame.src=document.getElementById("URL").value; } </script></html>I can't seem to find the problem with this code, it works in dreamweaver, but once Its saved and I docuble click on it, to run it in my chrome broswer, it dosen't work??? can some one please explain? 解决方案 Well you are missing both the <head> and <body> sections, which most browsers regard as essential for a 'well-formed' HTML document. You should also put your Javascript code in the <head> section, unless you have a specific reason for putting it further down on the page.<html><head> <title>My Page</title> <script language="javascript"> function LoadPage() { var objFrame = document.getElementById("myIframe"); objFrame.src = document.getElementById("URL").value; } </script></head><body> <form name="form1" method="post" action=""> <label for="urls"></label> <input type="submit" name="back" id="back" value="<" onClick="myIframe.history.back()"> <input type="submit" name="forward" id="forward" value=">" onClick="myIframe.history.forward()"> <input type="submit" name="Search" id="Search" value="Go" onClick="LoadPage()"> <input type="text" name="urls" id="URL" value="http://"> </form> <iframe src="http://www.google.com" width="500" height="400" frameborder="0" id="myIframe"></iframe></body></html> 这篇关于HTML / javascript - 制作webbrowser的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-26 18:45
查看更多