Sign up ×
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It's 100% free, no registration required.

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">
          <type>skin_js</type>
          <name>js/age-verification.js</name>
     </action>  
</reference>

to

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)

share|improve this question
    
You cannot. alert() simply shows a native message box, so it'll look however the OS makes it look. see here –  dh47 Jan 2 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 at 6:42

1 Answer 1

you can add with below code for css in skin folder

<reference name="head">
 <action method="addItem">
      <type>skin_css</type>
        <name>css/styles.css</name>
  </action>    
</reference>

and if want to create custom popup you can use

http://stackoverflow.com/questions/16653238/custom-popup-boxes-in-html-javascript-and-css

share|improve this answer
    
are you sure ?? so you mean to say we can apply styles to alert messages?? @liyakat –  dh47 Jan 2 at 6:38
    
@dh47 as i understood from question, he has made a js popup box as custom. –  liyakat Jan 2 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 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 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 at 6:45

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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