2009-11-11 5 views
1

두 페이지를 하나로 만드는 방법에 대한 참조가 필요합니다.PHP/JavaScript 한 페이지에 2 페이지를 결합하는 방법

원래 2 페이지가 있습니다. View.php와 comment.php

view.php에는 comment.php를 호출하는 링크가 있습니다. 'comment'링크를 클릭하면 팝업과 같이 comment.php가 열립니다. 댓글을 작성한 후 보내기를 클릭하면 닫히고 view.php가 반환됩니다.

문제는 팝업 대신에 그것을 클릭하기 전까지는 숨기고 싶습니다. 나는이 과정을 부르는 정확한 용어가 무엇인지 모른다. id, onclick 함수 및 프레임 함수와 비슷한 기능을 사용하여 javascript와 관련이 있다는 것을 알고 있습니다. 나는 그것이 무엇을 부르는 지 알지 못하기 때문에 연구하기가 어렵다. 그래서 누구든지 제게 그것이 무엇이라고 불렀는지 말해 주시길 바랍니다.

당신에게 업데이트]

대단히 감사합니다 : 사랑

모든 ..

인터넷에서이 코드를 발견했다. RageZ가 말한 것처럼 .it은 CSS와 자바 스크립트를 사용하여 img를 표시하고 숨 깁니다. 다른 사람들을 위해 사용하는 방법?

나는 내 comment.php를 함수로 변환하고 view.php n에 그 함수의 id를 사용해야한다. 그것은 가능한가?

<html> 
<head> 
<script> 
function changeme(id, action) { 
     if (action=="hide") { 
      document.getElementById(id).style.display = "none"; 
     } else { 
      document.getElementById(id).style.display = "block"; 
     } 
} 
</script> 

</head> 
<body> 
<img id="myIMG" style="display: none;" src="question.php.html"width="100" height="100" /> 
<span onclick="changeme('myIMG', 'show');" style="color: blue; text-decoration: underline; cursor: pointer;">Show the image</span> 
<span onclick="changeme('myIMG', 'hide');" style="color: blue; text-decoration: underline; cursor: pointer;">Hide the image</span> 
</body> 
</html> 

답변

0

당신은 팝업을하고 같은 페이지에서 서버에 데이터를 게시하는 아약스/DHTML을 사용할 수 있습니다.

  • jquery
  • dojo
  • ExtJS
  • prototype
  • 모든 내가 잊어 버린 :

    나는 당신이 주변에 자바 스크립트 프레임 워크의 많은이 빠른 것을 할 수있는 프레임 워크를 필요 생각

+0

내가 팝업하고 싶지 않아 .. 내가 그것을 클릭하지 않으면 숨길 수 있습니다. – user147685

+0

sori..i 내 진짜 문제를 말하는 걸 깜빡 했어 !! – user147685

+0

당신은 그 프레임 워크와 일부 CSS 페이지에서 요소를 숨기거나 표시 할 수 있습니다 ... – RageZ

1

당신은 다음과 같이 예를 들어 설명 된 절차를 수행 할 수 있습니다 Greybox 같은 뭔가

view.php

<script language="JavaScript"> 

function openComment(id) // Open comment.php in a new window and send the id of the thing you want to comment 
{ 
    window.open('comment.php?id='+id, '_blank'); 
} 

</script> 

<a href="#" onClick="openComment(1)">Comment</a> 

comment.php

<?php 
    if (isset($_POST['msg']) && intval($_POST['id']) > 0) // If a comment is sent and the id is a number > 0 
    { 
     /* Write your message to db */ 
?> 
<!-- Reload the underlying window and close the popup --> 
<script language="JavaScript"> 
window.parent.reload(); 
window.close(); 
</script> 
<?php 
    } 
    else // Show the Form to post a comment 
    { 
?> 
<form name="comment" action="comment.php" method="POST"> 
<input type="hidden" name="id" value="<?php echo $_GET['id'] ?>" /> 
<input type="text" name="msg" value="Input your comment here" /> 
<input type="submit" value="Submit" /> 
</form> 
<?php } ?> 
2

나는 당신이 찾고 어떻게 생각입니까?

팝업을 열지 않고 페이지의 새로운 pag ontop을 열면 예제를 가장 잘 체크 할 수 있습니다. 여기에서 말할 수있는 것보다 더 명확합니다.

관련 문제