Renlok Posted August 21, 2009 Share Posted August 21, 2009 how can you have it so when a user closes a popup window an input value is updated in the parent window (the window it was opened from) id really appreciate any help Quote Link to comment Share on other sites More sharing options...
student101 Posted August 23, 2009 Share Posted August 23, 2009 jquery? Why jquery? http://hspinfo.wordpress.com/tag/pass-value-from-popup-to-parent/ Quote Link to comment Share on other sites More sharing options...
Renlok Posted August 23, 2009 Author Share Posted August 23, 2009 well i have the code $(document).ready(function () { var num_images = $('#numimages', window.opener.document).val(); var now_images = {NUMIMAGES}; var image_cost = {IMAGE_COST}; if (num_images != now_images) { var fee_diff = (now_images - num_images) * image_cost; $("#to_pay", window.opener.document).text(parseFloat($("#to_pay", window.opener.document).text()) + fee_diff); $('#numimages', window.opener.document).val(now_images); } }); but it doest seem to work just makes the window crash the full javascript on the page is <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript"> $(document).ready(function () { var num_images = $('#numimages', window.opener.document).val(); var now_images = {NUMIMAGES}; var image_cost = {IMAGE_COST}; if (num_images != now_images) { var fee_diff = (now_images - num_images) * image_cost; $("#to_pay", window.opener.document).text(parseFloat($("#to_pay", window.opener.document).text()) + fee_diff); $('#numimages', window.opener.document).val(now_images); } }); </script> <!-- IF B_CROPSCREEN --> <script type="text/javascript" src="js/jquery.imgareaselect.js"></script> <script type="text/javascript"> function preview(img, selection) { var scaleX = {SCALEX} / selection.width; var scaleY = {SCALEY} / selection.height; $('#thumbprev').css({ width: Math.round((scaleX / {IMGRATIO}) * {IMGWIDTH}) + 'px', height: Math.round((scaleY / {IMGRATIO}) * {IMGHEIGHT}) + 'px', marginLeft: '-' + Math.round(scaleX * selection.x1) + 'px', marginTop: '-' + Math.round(scaleY * selection.y1) + 'px' }); $('#x1').val(selection.x1 * {IMGRATIO}); $('#y1').val(selection.y1 * {IMGRATIO}); $('#x2').val(selection.x2 * {IMGRATIO}); $('#y2').val(selection.y2 * {IMGRATIO}); $('#w').val(selection.width * {IMGRATIO}); $('#h').val(selection.height * {IMGRATIO}); } $(document).ready(function () { $('#save_thumb').click(function() { var x1 = $('#x1').val(); var y1 = $('#y1').val(); var x2 = $('#x2').val(); var y2 = $('#y2').val(); var w = $('#w').val(); var h = $('#h').val(); if (x1=="" || y1=="" || x2=="" || y2=="" || w=="" || h=="") { alert("You must make a selection first"); return false; } else { return true; } }); }); $(window).load(function () { $('#thumbnail').imgAreaSelect({ aspectRatio: '{RATIO}', onSelectChange: preview, x1: 0, y1: 0, x2: {STARTX}, y2: {STARTY} }); }); </script> if thats of any help and the {NUMIMAGES} are variables that a phrased in by php when the page is loaded Quote Link to comment Share on other sites More sharing options...
haku Posted August 24, 2009 Share Posted August 24, 2009 I don't think jquery has any popup window functions (I use it all the time and have never seen anything) so you are probably best just using pure javascript for your popup functions. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.