I need a text arcing script (arctext) for a design project. I have added the code and it works fine for the most part. The problem is, I have added an onclick
event to the script and it only works once. When you click again, it does nothing.
I have read a lot about doing away with the onclick
and using the .click
instead, but the problem is that the code that runs from the event is to assign a text value to a variable, that is then used to set the arc radius in the arc text script.
This is the code I have now:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script type="text/javascript" src="http://tympanus.net/Development/Arctext/js/jquery.arctext.js"></script>
<script>
function getrad(){
var R = document.getElementById("radius").value;
$().ready(function() {
$('#example').arctext({radius:R});
});
}
</script>
<input type="text" size="1" maxlength="3" id="radius" value=""><br/>
<input type="button" onclick"getrad()" value="Changearc"><br/>
This works one time, but not a second without refreshing – why?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…