Javascript Slider and Close Window Codes Conflict

550 Views Asked by At

I am building a website that uses a Javascript slider. When I tried the page, it worked well. I added another Javascript code that made the window close when I clicked the checkout button. After adding that code, the slider didn't work anymore.

All of this code is on a new window that pops up when people click from the index page. The new window opens, people can view images in the slider, and then click a button to close the page automatically and return to the index.

Does anyone have any idea why both codes won't work? Thanks for any help.

Initial Header Scripts

<script src="scripts/jquery-1.10.1.min.js"></script>
<script src="scripts/jquery.flexslider.js"></script>

Slider Code + New Window Code

<script type="text/javascript" charset="utf-8">
    $(window).load(function() {
  $('.flexslider').flexslider({
    animation: "slide",
    controlNav: "thumbnails"
  });
});
    </script>


  <script language="Javascript"> 
flag = 1; 
function newwin() { 
if (flag==1) { 
open("http://item2.gmarket.co.kr/Item/detailview/Item.aspx?goodscode=375790954", "_blank"); 
self.close(); 
} 
} 
</script> 

The button code for returning to the index

<a href='#' onclick="newwin();""><img src="images/purchase.png" width="90" height="30" /></a>
1

There are 1 best solutions below

1
On

onclick="newwin();""

see the extra " here.That might resolved your problem..