토타토타

input 입력하면 스크립트 소스에 등록되게 하고싶습니다.

<input type="text" name="formtext1"><a href="javascript:downloadHtmlSource();">확인</a>

<iframe id="ifrmAction" name="ifrmAction" width="50" height="50" scrolling="no" ></iframe>

<script>
function downloadHtmlSource()
{
 try
 {
  var ifrmAction = window.document.getElementById("ifrmAction");
  var sUrl = "http://test.php?ID_CUST=<?=$a?>";
  ifrmAction.src = sUrl;
  setTimeout("getSource()",1000);
 }
 catch (ex)
 {
 }
}

function getSource()
{
 try
 {
  var elBody = ifrmAction.document.body;
  alert(elBody.innerHTML);
 }
 catch (ex)
 {
 }
}
</script>

위의 소스중에요 input 박스에 숫자를 입력하면 중간에 있는 <?=$a?> <-- 이부분에 들어가서
실행되게 하려면 어떻게 해야 할까요?

|

댓글 1개

<input type="text"

onChange="sUrl='http://test.php?ID_CUST='+this.value;"

name="formtext1"><a href="javascript:downloadHtmlSource();">확인</a>

<iframe id="ifrmAction" name="ifrmAction" width="50" height="50" scrolling="no" ></iframe>

<script>
var sUrl='';
function downloadHtmlSource()
{
try
{
var ifrmAction = window.document.getElementById("ifrmAction");

ifrmAction.src = sUrl;
setTimeout("getSource()",1000);
}
catch (ex)
{
}
}

function getSource()
{
try
{
var elBody = ifrmAction.document.body;
alert(elBody.innerHTML);
}
catch (ex)
{
}
}
</script>

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기
🐛 버그신고