弹出窗口关闭事件的更改按钮

时间:2012-07-05 07:23:17

标签: php javascript jquery

当用户点击按钮时,我想要打开一个弹出窗口,当我点击弹出窗口中的“接受”按钮时,弹出窗口将关闭。但是当它关​​闭时,我想更改用户点击的按钮以打开弹出窗口。我使用的是图像而不是按钮。请告知我该怎么做。

它不适合我。我认为你没有得到我的问题。“我点击图像然后弹出窗口打开后再次接受该弹出窗口中的whaterver它将显示前一个窗口,然后该图像应该改变”我该怎么办?那样做?我在这里发送更新的代码:

<?php
session_start();

if($_SESSION['typeimagedis']=='image/gif') 
        $namedis=$_SESSION['typeimagenamedis'];
        else
    $namedis=$_SESSION['typeimagenamedis'];


    if ($_POST['hidcropimg'] == 'hidcropimg')
{
if(file_exists('images/'.$_SESSION['typeimagenamedis']))
{
unlink('images/'.$_SESSION['typeimagenamedis']);
}
    $targ_w =$_POST['w'];$targ_h = $_POST['h'];
    $jpeg_quality = 20;

if(($_POST['typeimage'] == "image/gif"))
    {
    $src='upload/'.$_SESSION['typeimagenamedis'];
    $img_r = imagecreatefromgif($src);
    }
    if(($_POST['typeimage'] == "image/jpg")|| ($_POST['typeimage'] == "image/jpeg")|| ($_POST['typeimage'] == "image/pjpeg"))
    {
    $src='upload/'.$_SESSION['typeimagenamedis'];
    $img_r = imagecreatefromjpeg($src);
    }


    $dst_r = ImageCreateTrueColor( $targ_w, $targ_h );

    @imagecopyresampled($dst_r,$img_r,0,0,$_POST['x'],$_POST['y'],
    $targ_w,$targ_h,$_POST['w'],$_POST['h']);
$yes=1;
if(($_POST['typeimage'] == "image/gif"))
    {
    $name=$_SESSION['typeimagenamedis'];
        imagegif($dst_r,'images/'.$name,$jpeg_quality);
    }
    if(($_POST['typeimage'] == "image/jpg")|| ($_POST['typeimage'] == "image/jpeg") || ($_POST['typeimage'] == "image/pjpeg"))
    {
    $name=$_SESSION['typeimagenamedis'];
        imagejpeg($dst_r,'images/'.$name,$jpeg_quality);
    }

}

    if($_POST['subacc']=='Accept')
    {
    copy('images/'.$_SESSION['typeimagenamedis'],'crop/'.$_SESSION['typeimagenamedis']);
    setcookie ("cronimagename", $_SESSION['typeimagenamedis'], time()+60*60*24*30,'/','iphoneid.com');}
    ?>

    <script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script>
    <script type='text/javascript'>
    function closewin(){  
    window.close();
    $('#openimg',opener.document).attr('src','/v/vspfiles/photoutility/images/clickheretoTHK_off.gif');
    //alert('openimg');
    }
    </script>

<?php   

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>

        <script src="../js/jquery.min.js"></script>
        <script src="../js/jquery.Jcrop.js"></script>
        <link rel="stylesheet" href="../css/jquery.Jcrop.css" type="text/css" />
        <link rel="stylesheet" href="demo_files/demos.css" type="text/css" />
        <? if($_GET['ref']==1){?>
        <META HTTP-EQUIV="refresh" CONTENT="0; URL=http://serverl.iphoneid.com/demos/croped.php?ProductCode=<?=$_GET['ProductCode']?>">
<? }?>


    </head>

    <body>

    <div id="outer">
    <div class="jcExample" style="width: 802px;height: 1344px;">
    <table width="151" align="center" style="padding-right:65px;" > 
      <tr><td width="54"><form id="frmacc" name="frmacc" method="post" action=""><input type="submit" id="subacc" name="subacc" value="Accept" onClick="closewin();"  /></form></td><td width="238">
    <form id="frmcancel" name="frmcancel" method="post" action="crop.php?ref=1&ProductCode=<?=$_GET['ProductCode']?>" ><input type="submit" id="subcancel" name="subcancel" value="Select Again"  /></form></td></tr></table>
    <div class="article" style="position:relative; margin:70px 0 0 230px;">
<? if($_GET['ref']==1){
?>
<img  src="wait.gif" width="200px" height="75px"  >
<?
}else{ ?>
        <div style="float:left; height:530px; padding:0px 0 0 0px; width:580px;  background:url(<? if($_GET['ProductCode']=='IPBB'){?>black.png<? }elseif($_GET['ProductCode']=='IPBR'){?>red.png<? }elseif($_GET['ProductCode']=='IPBW'){?>white.png<? }?>) no-repeat; position:relative; z-index:999999999999">

        </div><!--style="padding-top:<?=$padding?>px"-->
        <div align="center"   style=" height: 148px; width: 148px; position:absolute; top:161px; left:61px; z-index:1" ><img  src="images/<?=$namedis?>" height="148" width="148" /></div>
<? }?>
    </div>
   </div>

    </div>
    </body>

</html>

1 个答案:

答案 0 :(得分:1)

要从弹出窗口更改按钮的背景图像,请使用以下命令:

<script>
$("#openimg1",opener.document).attr("src","/image-path-here");
</script>