Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Jan 2008
    Posts
    12
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Help making popout window with this html form..

    I got this 5 star rating script online and I'm trying to make a window popup instead of going to addrating.php on the same page. Can't seem to do it. I've added the onsubmit javascript, but still can't do it.

    PHP Code:
    <SCRIPT TYPE="text/javascript">
    function openWindow(url){
    window.open(url,'','width=640,height=480,top=100,left=100');
    }
    </SCRIPT>

            <form name="rate" method="post" action="<?php echo($hm2); ?>/addrating.php" onSubmit="openWindow('addrating.php');">
                 <b>This Page has been currently rated as: </b>
                 <?php for($i=1;$i<=5;$i++)
                         {
                           if(
    $rateval>=1)
                        {
                       echo 
    "<img src=\"$hm2/images/star2.gif\">";
                               
    $rateval=$rateval-1;
                        }
                        else if(
    $rateval>=0.5)
                        {
                        echo 
    "<img src=\"$hm2/images/star3.gif\">";
                       
    $rateval=$rateval-1;
                        }
                         else if (
    $rateval<0.5 && $rateval>0)
                        {
                       echo 
    "<img src=\"$hm2/images/star1.gif\">";
                       
    $rateval=$rateval-1;
                        }
                        else if(
    $rateval<=0)
                        {
                       echo 
    "<img src=\"$hm2/images/star1.gif\">";
                        }
                        }    
               
    ?>
         </td>
       </tr>
         <style>
           .star{cursor:pointer; }

         </style>
         <Script language=javascript>
          function selstar(val)
          {
        for(var x=1;x<=val;x++)
        {
            document['i'+x].src="<?php echo "$hm2";?>/images/star2.gif";
        }
        
          }
          function remstar(val)
          {
        for(var x=1;x<=val;x++)
        {
            document['i'+x].src="<?php echo "$hm2";?>/images/star1.gif";
        }
          }

          function setrate(val)
          {
        document.rate.rating.value=val;
        document.rate.submit();
          }
         </script>

       <tr>
          <td align=center>
                <b>Rate this Page :</b> 
                <img name=i1 class=star onmouseover="selstar(1)" onmouseout="remstar(1)" onclick="setrate(1)" src="<?php echo "$hm2";?>/images/star1.gif">
                <img name=i2 class=star onmouseover="selstar(2)" onmouseout="remstar(2)" onclick="setrate(2)" src="<?php echo "$hm2";?>/images/star1.gif">
                <img name=i3 class=star onmouseover="selstar(3)" onmouseout="remstar(3)" onclick="setrate(3)" src="<?php echo "$hm2";?>/images/star1.gif">
                <img name=i4 class=star onmouseover="selstar(4)" onmouseout="remstar(4)" onclick="setrate(4)" src="<?php echo "$hm2";?>/images/star1.gif">
                <img name=i5 class=star onmouseover="selstar(5)" onmouseout="remstar(5)" onclick="setrate(5)" src="<?php echo "$hm2";?>/images/star1.gif">
                <input type="hidden" name="rating">
                <input type="hidden" value="<?php echo "$url"?>" name="url">
                <input type="hidden" value="<?php echo "$rip"?>" name="ip">
                <input type="hidden" value="<?php echo "$id"?>" name="templateid">

            </form>

  • #2
    Senior Coder gnomeontherun's Avatar
    Join Date
    Sep 2007
    Location
    Houston
    Posts
    2,846
    Thanks
    10
    Thanked 238 Times in 229 Posts
    Code:
    <form name="rate" method="post" action="<?php echo($hm2); ?>/addrating.php" target="_blank">
    jeremy - gnomeontherun
    Educated questions often get educated answers, and simple questions often get simple answers.

  • Users who have thanked gnomeontherun for this post:

    javanoobie9 (02-28-2008)


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •