Home › Forums › JavaScript › Change Font through Java Script
- This topic is empty.
-
AuthorPosts
-
May 17, 2016 at 6:46 am #241785
Suhas_K
ParticipantHi all,
I’ve set onClick function in my javascript file.
In which I am changing elementtext (paragraph) to another paragraph. It happens very well in English Text.
Now I want to change the paragraph to the language other than English i.e. I want to display the paragraph to local language (MARATHI).
I’ve embed require fonts, but it displays question marks (?????????) after I clicked the button.
How to do this? Anybody help please.Regards
May 17, 2016 at 7:34 am #241788Paulie_D
MemberAre you using UTF-8?
Without seeing it NOT working I’m not sure there is much we can do.
May 17, 2016 at 8:11 am #241793GMK Hussain
Participant<script> $( "#myButton" ).click(function(){ $( "#myFont" ).css('font-family', "my font name here"); }) </script>
May 17, 2016 at 8:26 am #241797Paulie_D
MemberI understand the script but without a demo (perhaps in Codeoen.io) and the actual font I’m not sure there is much we can do.
May 18, 2016 at 3:11 am #241821Suhas_K
ParticipantThis is my HTML
text, which I want to change with local language text using onclick function
HTML file :-
Before showing any user supplied string in this way you should first check that it does not contain HTML markup, otherwise you may get security problems (XSS).
<button id=”btn2″ onclick=”secondFunction()”>Click me!</button>
JavaScript File –
JavaScript Function:-function secondFunction() {
document.getElementById(“two”).style.fontFamily = “shree_dev_otf_0708regular”;
document.getElementById(“two”).innerHTML = ‘मराठी बोलणा-यांची एकूण लोकसंख्या ९,००,००,००० आहे. मराठी भाषा ९ व्या शतकापासून प्रचलित आहे.
मराठी भाषेची निर्मिती संस्कृतमधून निर्माण झालेल्या महाराष्ट्री प्राकृत व अपभ्रंश या भाषांपासून झाली आहे. याउलट मराठी आणि काही अन्य भारतीय भाषांच्यावर
संस्कार होऊन संस्कृत भाषा बनली असेही काही विद्वान मानतात. मराठी भाषा ही इसवी सनाच्या आधीही होती असे सिद्ध करण्याचा प्रयत्न प्रा. हरी नरके
करित आहेत.’;
}May 18, 2016 at 4:17 am #241823Paulie_D
MemberAs I said a DEMO is Codepen would be more use.
May 18, 2016 at 11:55 am #241845I.m.learning
ParticipantI think you were on the right path Paulie;
I just read this article
http://www.joelonsoftware.com/articles/Unicode.htmlThe very second paragraph was [actually just a sentence]:
“Did you ever get an email from your friends in Bulgaria with the subject line “???? ?????? ??? ????”?” -
AuthorPosts
- The forum ‘JavaScript’ is closed to new topics and replies.