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)
-
You cannot. alert() simply shows a native message box, so it'll look however the OS makes it look. see heredh47– dh472015年01月02日 06:40:00 +00:00Commented Jan 2, 2015 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– Moh3n2015年01月02日 06:42:09 +00:00Commented Jan 2, 2015 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
https://stackoverflow.com/questions/16653238/custom-popup-boxes-in-html-javascript-and-css
-
are you sure ?? so you mean to say we can apply styles to alert messages?? @liyakatdh47– dh472015年01月02日 06:38:05 +00:00Commented Jan 2, 2015 at 6:38
-
@dh47 as i understood from question, he has made a js popup box as custom.liyakat– liyakat2015年01月02日 06:39:38 +00:00Commented Jan 2, 2015 at 6:39
-
that mean you didn't understood the question he just added
alert('Sorry! Come back in a few years!')alert messages andcsscannot be added to alert messages moreover your answer is not at all related to his question.dh47– dh472015年01月02日 06:41:30 +00:00Commented Jan 2, 2015 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– liyakat2015年01月02日 06:43:13 +00:00Commented Jan 2, 2015 at 6:43
-
@dh47, i am agree with you that we can not change color for popup which used function like
promptliyakat– liyakat2015年01月02日 06:45:03 +00:00Commented Jan 2, 2015 at 6:45