Jump to content

Javascript popup box


mark110384

Recommended Posts

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.

Link to comment
Share on other sites

<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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.