javascript - Multiple resizeText in one html -


i have made fiddle: http://jsfiddle.net/1an9yh78/

i can't buttons change specific font-size in assigned div. it's only changing 1 div. help.

html

<div id="t1"> text1 </div> <input name="resize1" type="button" value="&nbsp;+&nbsp;" onclick="resizetext(1)" /> <input name="resize2" type="button" value="&nbsp;-&nbsp;"  onclick="resizetext(-1)" />  <div id="t2">   text2   </div>      <input name="resize3" type="button" value="&nbsp;+&nbsp;"   onclick="resizetext(1)" /> <input name="resize4" type="button" value="&nbsp;-&nbsp;"  onclick="resizetext(-1)" /> 

javascript

function resizetext(multiplier) { var elem = document.getelementbyid("t1"); var currentsize = elem.style.fontsize || 1; elem.style.fontsize = ( parsefloat(currentsize) + (multiplier * 0.2)) +  "em"; }  function resizetext(multiplier) { var elem = document.getelementbyid("t2"); var currentsize = elem.style.fontsize || 1; elem.style.fontsize = ( parsefloat(currentsize) + (multiplier * 0.2)) +  "em"; } 


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -