i have made a js popup box to verify customers age before enter to a category.

i made a age-verification.js file with this code included, in my templat js/ folder:

var agePrompt=prompt("What is your age?");

if (agePrompt>=18) alert('Welcome!')
else {
alert('Sorry! Come back in a few years!')
document.location=" ";//link if not 18


and i added this XML code:

<reference name="head">
     <action method="addItem">


Admin -> Catalog -> Manage Categories -> {Selected category} -> Custo Design -> Custom Layout Update

now i want to add some css styles to my js popup window.

how to do that? (with details please)

  • You cannot. alert() simply shows a native message box, so it'll look however the OS makes it look. see here – dh47 Jan 2 '15 at 6:40
  • @dh47 i know i should do it with html. but i don't know how. i will thankful if some one explain it for me. – Moh3n Jan 2 '15 at 6:42

you can add with below code for css in skin folder

<reference name="head">
 <action method="addItem">

and if want to create custom popup you can use


  • are you sure ?? so you mean to say we can apply styles to alert messages?? @liyakat – dh47 Jan 2 '15 at 6:38
  • @dh47 as i understood from question, he has made a js popup box as custom. – liyakat Jan 2 '15 at 6:39
  • that mean you didn't understood the question he just added alert('Sorry! Come back in a few years!') alert messages and css cannot be added to alert messages moreover your answer is not at all related to his question. – dh47 Jan 2 '15 at 6:41
  • but if he will make popup with custom html and instead of alert() he can use custom alert. at that time above code will utilize. – liyakat Jan 2 '15 at 6:43
  • @dh47, i am agree with you that we can not change color for popup which used function like prompt – liyakat Jan 2 '15 at 6:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.