Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Change Font through Java Script Reply To: Change Font through Java Script

#241821
Suhas_K
Participant

This 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 = ‘मराठी बोलणा-यांची एकूण लोकसंख्या ९,००,००,००० आहे. मराठी भाषा ९ व्या शतकापासून प्रचलित आहे.
मराठी भाषेची निर्मिती संस्कृतमधून निर्माण झालेल्या महाराष्ट्री प्राकृत व अपभ्रंश या भाषांपासून झाली आहे. याउलट मराठी आणि काही अन्य भारतीय भाषांच्यावर
संस्कार होऊन संस्कृत भाषा बनली असेही काही विद्वान मानतात. मराठी भाषा ही इसवी सनाच्या आधीही होती असे सिद्ध करण्याचा प्रयत्न प्रा. हरी नरके
करित आहेत.’;
}