1

ポップアップウィンドウにjavascriptとphpを使用しています。計画は、親ページの行 ID をポップアップ ウィンドウに渡すことです。

このコードでうまくいきます:

<a href="#" onclick="PopupCenter('example.php', 'myPop1',500,400); " class="add"><img src='images/buttons/edit.png' title='Edit Content'></a>

ポップアップが表示されます。しかし、追加しようとする?textID=<?$row['textID']?>と、これは次のようになる行IDを渡すために使用しているコードです:

<a href="#" onclick="PopupCenter('example.php?textID=<?$row['textID']?>', 'myPop1',500,400); " class="add"><img src='images/buttons/edit.png' title='Edit Content'></a>

ポップアップが機能しません。ページを更新しているだけのようです。ご協力ありがとうございました。

ここに私の完全なコードがあります

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<?php
    include("global.php");
?>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8">
<title>About | ILAM</title>

<!-- main css -->
<link href="style.css" rel="stylesheet" type="text/css">
<link href="styleAdmin.css" rel="stylesheet" type="text/css">

<script type= "text/javascript">
    <!-- showHideDiv -->
    function divHideShow(divToHideOrShow){
        var div = document.getElementById(divToHideOrShow);
        if (div.style.display == "block"){
            div.style.display = "none";}
        else{
            div.style.display = "block";}
    }         

    <!-- popUp -->
        function PopupCenter(pageURL, title,w,h) 
            {
                var left = (screen.width/2)-(w/2);
                var top = (screen.height/2)-(h/2);
                var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
            }
</script>
</head>

<!-- Body -->
<body>
<div id="pagewrap">
    <!-- Header -->
    <div id="header">
        <div class="floating-menu">
            <div class="logo"><img src="images/static/ilamLogo.png"></div>
            <div class="translator">
            </div>
            <ul>
                <li><a href="join.php">Join Us!</a></li>
                <li><div class="indent">&nbsp;</div></li>
                <li><a href="contact.php">Contact</a></li>
                <li><a href="career.php">Career</a></li>
                <li><a href="gallery.php">Gallery</a></li>
                <li><a href="facilities.php">Facilities</a></li>
                <li><a href="courses.php">Courses</a></li>
                <li><a href="#" class="active">About</a></li>
                <li><a href="index.php">Home</a></li>
                <li><a href="javascript:divHideShow('menuContentBanner');divHideShow('menuContentBannerText');divHideShow('menuOpenPost');divHideShow('menuMainPost');divHideShow('menuFooterLeft');divHideShow('menuFooterMiddle');divHideShow('menuFooterRight');">Admin</a></li>
            </ul>
        </div>
    </div>
    <!-- //Header -->
    <!-- ContentBanner -->
    <div id="contentBanner"> 
        <div id="menuContentBanner" class="menuBarStyle">
            <div class="addEditDelete">
                <ul>
                <li><a href="addImage.php"><img src="images/buttons/edit.png" title="Edit Image"></a></li>
                </ul>
            </div>
        </div>
    <img src="images/headers/aboutHeader.jpg"></div> <!--BannerImage -->    
    <div class="textLeft">
        <div id="menuContentBannerText" class="menuBarStyle">
            <div class="addEditDelete">
                <ul>
                <li><a href="#" onclick="PopupCenter('edit_article.php', 'myPop1',500,400); "  class="add"><img src="images/buttons/edit.png" title="Edit Content"></a></li>
                </ul>
            </div>
        </div>  
    <h3>As an Academic Institution.</h3><p> ILAM takes to heart its responsibilities, not only to its students, but also to its team, and community</p></div> <!-- BannerText -->
    <!-- //ContentBanner -->
    <!-- Content: Blue -->
    <div id="content">  
        <!-- SidePost -->
        <aside id="sidebar">
            <section class="widget">
                <ul>
                    <li><a href="#"><img src="images/buttons/factsbtn.png" onmouseover="this.src='images/buttons/factsbtnHover.png'" onmouseout="this.src='images/buttons/factsbtn.png'"></a></li>
                    <li><a href="#"><img src="images/buttons/testibtn.png" onmouseover="this.src='images/buttons/testibtnHover.png'" onmouseout="this.src='images/buttons/testibtn.png'"></a></li>
                    <li><a href="#"><img src="images/buttons/promosbtn.png" onmouseover="this.src='images/buttons/promosbtnHover.png'" onmouseout="this.src='images/buttons/promosbtn.png'"></a></li>
                </ul>
            </section>
        </aside>
    <!-- //SidePost -->
    <!-- OpenerPost -->
        <article class="openerPost">
            <table>
                <tr>
                    <div id="menuOpenPost" class="menuBarStyle">
                        <div class="addEditDelete">
                        <ul>
                            <li><a href="#" onclick="PopupCenter('example.php?promoID=<?=$row['promo_id']?>', 'myPop1',400,400); "><img src="images/buttons/edit.png" height="27" width="65"></a></li>
                        </ul>
                        </div>
                    </div>
                </tr>
                <tr>
                    <td><?php
                            $query="SELECT * from text_tb WHERE textID = '1'";
                            $result=mysql_query($query);
                            if (!$result) {
                                echo 'Could not run query: ' . mysql_error();
                                exit;
                            }
                            $row = mysql_fetch_row($result);
                            echo $row[1]; // the email value
                            ?>
                    </td>
                </tr>
            </table>
        </article>
    </div>
    <!-- //OpenerPost -->
    <!-- Content: White -->
    <div id="content">
        <article class="mainPost">
            <table>
                <tr>
                    <div id="menuMainPost" class="menuBarStyle">
                        <div class="addEditDelete">
                        <ul>
                            <li><a href="addImage.php"><img src="images/buttons/edit.png" title="Edit Content"></a></li>
                        </ul>
                        </div>
                    </div>
                </tr>
                <tr><td class="title">Our Mission</td></tr>
                <tr>
                    <td><p>As an academic institution, ILAM takes to heart its responsibilities, not only to its students, 
                    but also to its team, and community. We know that in addition to reaching our vision for the school, ILAM has
                    a role and certain duties that it has to carry out.</p></td>
                </tr>

                <tr>
                    <td class="subtitle">For the Students.</td>
                </tr>
                <tr>
                    <td><p>International Language Academy Manila (I.L.A.M.) is a premier language school in Makati 
                    City, Philippines whose mission is to provide quality education to professionals and 
                    non-professionals aiming to be proficient in English.  The school takes pride in its ESL/EFL
                    courses such as:  Functional Grammar, Conversation, Business Writing, Business English, 
                    Pronunciation, IELTS review, TOEIC review, etc.  which are all taught in a multidisciplinary 
                    setting to ensure comprehensive skill development in the four areas of communication (listening,
                    speaking, reading, and writing). Apart from teaching English, the school also intends to inculcate strong intercultural 
                    awareness among its students by integrating outdoor activities in its curriculum. </p></td>
                </tr>   
                <tr>
                    <td class="subtitle">For the Community.</td>
                </tr>               
                <tr>                
                    <td><p>As an academic institution, ILAM takes heart to its responsibilities in promoting education and tourism in the country, which is the reason behind its partnership with the Bureau of Immigration and various multinational companies for English training. It aims to show its foreign students how much the 
                    country has improved, and that the Philippines is a place where they can always find another
                    home. ILAM goes beyond the technicalities of language. It offers students the opportunity to
                    foster a deeper understanding of various cultures and thus, enables them to appreciate more the 
                    beauty of language as they get to communicate and interact with different people.</p></td>
                </tr>
                <tr>
                    <td class="subtitle">For its Team.</td>
                </tr>
                <tr>
                    <td><p>As an academic institution, ILAM takes heart to its responsibilities in promoting education 
                    and tourism in the country, which is the reason behind its partnership with the Bureau of Immigration and various
                    multinational companies for English training. It aims to show its foreign students how much the 
                    country has improved, and that the Philippines is a place where they can always find another
                    home. ILAM goes beyond the technicalities of language. It offers students the opportunity to
                    foster a deeper understanding of various cultures and thus, enables them to appreciate more the 
                    beauty of language as they get to communicate and interact with different people.</p></td>
                </tr>
            </table>
        </article>
    </div>

    <footer id="footer">
        <table>
            <tr>
                <td>
                    <div id="menuFooterLeft" class="menuBarStyle">
                        <a href="addImage.php"><img src="images/buttons/edit.png" title="Edit Content"></a>
                    </div>
                    <h3>Let's Meet</h3>
                    <p>2/F Makati Creekside Mall Bldg. Amorsolo Cor. VA Rufino St. Legazpi Village, Makati City Philippines</p></td>
                <td>
                    <div id="menuFooterMiddle" class="menuBarStyle">
                        <a href="addImage.php"><img src="images/buttons/edit.png" title="Edit Content"></a>
                    </div>
                    <h3>Let's Talk</h3>
                    <p>Telephone: 632-8400285 / 519 9502<br>Cellphone: 0917-5324332</p></td>
                <td>
                    <div id="menuFooterRight" class="menuBarStyle">
                            <a href="addImage.php"><img src="images/buttons/edit.png" title="Edit Content"></a>
                    </div>
                <h3>The Affiliates</h3>
                <p>Accenture<br>
                Asian Institute of Management<br>
                ConveyThis<br>
                The Little Web Directory<br></td>
            </tr>
            <tr>
                <td class="copyright">Copyright &copy; 2012 ILAM</td>
            </tr>
        </table>
    </footer>
</div>
<!-- /#pagewrap -->

</body>
</html>
4

3 に答える 3

1

echo次のように使用する必要があります。

<?php echo($row['textID']) ?>
于 2012-12-18T18:17:31.947 に答える
1

どうやらPHPのようです。PHP 変数を HTML に挿入するにはecho、次のように を使用します。

<a href="#" 
    onclick="PopupCenter('example.php?textID=<?php echo $row['textID'] ?>', 'myPop1',500,400); " class="add">
    <img src='images/buttons/edit.png' title='Edit Content'>
</a>
于 2012-12-18T18:21:26.237 に答える
0

省略形が許可されている場合、これは機能するはずです

<?=$row['textID']?>
于 2012-12-18T18:45:34.190 に答える