December 23, 2014

Source: Internet
Author: User

Preface: The front page needs a large medium and small three fonts, these three fonts corresponding to a CSS file, and then the client with a cookie to save the CSS file name prefix. The implementation is this way, the user click Select "Big Small" three buttons, and then use the $.cookie method of jquery to the client to save "fontSize" Such a variable, the variable value corresponds to one of the CSS file name of the three font. Then compile the JSP page with the JSTL tag to take fontsize value, load the corresponding CSS file.

  

Js:

Jsp:

So here's the problem: I localhost:8080/project/the "big" font on my home page, but found out how localhost:8080/project/register.jsp didn't work, The value that the cookie takes out is not the same as the value of the home page, which is why?

My solution: Use Firefox to view cookies: There are two fontsize of wood!

Look at the details below, the original path is not the same,--, one is localhost:8080/project/; The other is localhost:8080/project/register.jsp.

Workaround: Add the path attribute when setting cookies with jquery.

    

This way, no matter on which page settings cookie,fontsize are only one, take out the nature is the only fontsize. (Today we have this problem to record it quickly)

  

---------------------------Split Line---------------------------

found that the current diary can not be called ' meter of the building station Diary ', because this is not the construction station encountered problems, but the work encountered problems, the amount, said so many.

December 23, 2014

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.