是否有任何可能的方式從類中獲取輸入廣播值信息(externaly)?Javascript從彈出式輸入廣播級獲得價值
我做一百萬的嘗試......
下面是代碼IM stucked到:
Parent.htm
<html>
<head>
<title></title>
</head>
<body>
<input type="text" id="txtName" readonly="readonly" />
<input type="button" value="Select Name" onclick="SelectName()" />
<script type="text/javascript">
var popup;
function SelectName() {
popup = window.open("Popup.htm", "Popup", "width=300,height=100");
popup.focus();
return false
}
</script>
</body>
</html>
這裏是頁,我不能定義以獲取有價值的信息。
Popup.htm
<html>
<body>
<form class="ddlNames">
<input type="radio" name="ddlNames" id="num" value="one">
<input type="radio" name="ddlNames" id="num" value="two">
<input type="radio" name="ddlNames" id="num" value="three">
</form>
<br />
<br />
<input type="button" value="Select" onclick="SetName();" />
<script type="text/javascript">
function SetName() {
if (window.opener != null && !window.opener.closed) {
var txtName = window.opener.document.getElementById("txtName");
txtName.value = document.getElementsByClassName("ddlNames")[0].value;
}
window.close();
}
</script>
</body>
</html>
我嘗試過這種方式:
<input type="radio" class="ddlNames" name="ddlNames" id="num" value="one">
<input type="radio" class="ddlNames" name="ddlNames" id="num" value="two">
<input type="radio" class="ddlNames" name="ddlNames" id="num" value="three">
爲了讓每一個ddlNames
類,但它不工作?
對不起得到選中的值,我的問題可能會吸引更多的提問者,因爲標題中。 我沒有找到你發給我的帖子,可能這篇文章會幫助其他人更容易找到解決方案。希望你能理解我,一切順利。 –