我正在使用 phonegap(html、javascript)开发跨平台移动应用程序 问题是所选项目相关图像未在 iframe 中显示,此图像显示另一个页面,请参见下面的代码
function onchangeevent(mySelect)
{
PageIndex2=mySelect.selectedIndex;
{
if
(
mySelect.options[PageIndex2].value != "none"
)
{
frames['iframe2'].location.href = mySelect.options[PageIndex2].value;
}
}
}
</script>
</head>
<body>
<form name="form">
<p><select NAME="selectimage" SIZE="1" onChange="onchangeevent(this.form.selectimage)">
<option VALUE="none" SELECTED>Select a page and go</option>
<option VALUE="ic_launcher.png">one</option>
<option VALUE="icon.png">two</option>
</select> </p>
<p>
<IFRAME NAME="iframe2" frameborder="3" ALIGN="top" HEIGHT="100%" WIDTH="95%" HSPACE="10" VSPACE="10" align="middle"></IFRAME>
</p>
</form>
</body>
</html>
iframe 标签不工作 android inbuild 浏览器如何解决这个问题? 请告诉所有浏览器支持的任何替代标签 预先感谢 摇摇欲坠
最佳答案
正如您在此处 Posting form to a hidden iframe in Android browser 的上一个问题中看到的那样
future 的浏览器/标准将不支持 iframe。
相反,创建一个图片标签并更新它的 SRC。
function onchangeevent(mySelect)
{
PageIndex2=mySelect.selectedIndex;
{
if
(
mySelect.options[PageIndex2].value != "none"
)
{
document.getElementById('myimage').src = mySelect.options[PageIndex2].value;
}
}
}
</script>
</head>
<body>
<form name="form">
<p><select NAME="selectimage" SIZE="1" onChange="onchangeevent(this.form.selectimage)">
<option VALUE="none" SELECTED>Select a page and go</option>
<option VALUE="ic_launcher.png">one</option>
<option VALUE="icon.png">two</option>
</select> </p>
<p>
<img src="about:blank" id="myimage" alt="" />
</p>
</form>
</body>
</html>
关于html - iframe 标签不工作 android inbuild 浏览器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9178189/