如何從iframe表單id檢索值,並將其調用到我的客戶端html。檢索iframe值到客戶端頁面
(客戶端HTML) sample.html
<head>
<script>
function alertThis(){
alert(parent.myframe.formsubmit.a_token.value);
}
</script>
</head>
<body>
<iframe name = "myframe" src="http://domain.com/sample/index.php">
<button onClick = "alertThis();">Click Here</button>
</body>
(服務器端PHP) 的index.php
<form name = "formsubmit">
<input id = "a_token" value="<?php echo $_SESSION['user'] ?>"/>
</form>
,但它不返回任何。
仍然沒有工作。 –
@RobinCarloCatacutan請立即嘗試,我必須努力。 –
但仍然無法正常工作,我想我只能找到另一種方式來加載我的PHP使用JavaScript來獲取我的值存儲在PHP中。如果你碰巧知道一些想法,你可以借給一些嗎? XD –