Jump to content

Кнопка "Добавить в корзину" как на ozon.ru


Recommended Posts

Добрый день!
Подскажите, как реализовать кнопку "Добавить в корзину" как на ozon.ru.
То есть мне нужно чтобы при 1-м нажатии на "добавить в корзину" товар добавлялся в корзину, кнопка менялась и при 2-м нажатии переходило в саму корзину. Дайте пример кода, пожалуйста.
Вот пример работы такой кнопки: http://www.ozon.ru/context/detail/id/5021900/?item=5021222

Link to post
Share on other sites

<script>function myFunc (x){x.style.backgroundColor = 'aqua';x.innerHTML = 'Ещё раз!';x.onclick = function ()   {   alert ('Уходим отсюда!');   location.href = 'http://google.com/';   }}</script> <div style="width: 150px; line-height: 40px; cursor: pointer;            text-align: center; background-color: lime"            onclick="myFunc (this)">Жми!</div>
Link to post
Share on other sites
  • 10 months later...

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.   Paste as plain text instead

  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.

Loading...
×
×
  • Create New...