mark110384 Posted June 24, 2008 Share Posted June 24, 2008 I'm pretty new to Javascript and I'm trying to make a popbox, the popbox will appear on the reloaded page when the user selects an item to be added to there shopping cart just to alert the user that it has been successfully added to the cart. However I have no idea in linking the buttons to do both task at present I have this button to add the item. <tr> <td><? echo "<a href='addcart.php?item_selected=$itemid'><img src = 'addtotrolley.bmp' border = '0'/></a>"?> </td> </tr> and this button is just a demo button displaying the javascript popup box <a href="javascript://" onClick="show_it()" ><img src = 'addtotrolley.bmp' border = '0'/></a> <div id="box1"> <font face="arial" size = "2">This item has been added to your trolley. </font> </div> I just haven't got a clue to make the button do the two tasks. Quote Link to comment https://forums.phpfreaks.com/topic/111679-javascript-popup-box/ Share on other sites More sharing options...
mark110384 Posted June 24, 2008 Author Share Posted June 24, 2008 Actually I think it would be best that box apears on form reload, still haven't got a clue on how do that though Quote Link to comment https://forums.phpfreaks.com/topic/111679-javascript-popup-box/#findComment-573249 Share on other sites More sharing options...
xtopolis Posted June 25, 2008 Share Posted June 25, 2008 <tr> <td><a href='addcart.php?item_selected=<?php echo $itemid; ?>' onclick="show_it()"><img src='addtotrolley.bmp' border='0' /></td> </tr> Notes: -I changed your link a bit. I had it only echo the var at the end. -I added the onclick event to your link. Simple it's like this: <a href="site.php" onclick="function()">LinkName</a> -addtotrolley.bmp, consider resaving this picture as a jpg, the filesize is much better, making your pages load faster. -you had a bbc code [/url] in there.. I took it out since I didn't see the starting one. As for a 'popbox', im not sure what you mean. You can popup an alert using the alert() function. This is that box that you can only click ok to. Or you can open a new window and resize it accordingly. This is with the window.open function. Hope that points you in the right direction. Quote Link to comment https://forums.phpfreaks.com/topic/111679-javascript-popup-box/#findComment-573699 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.