I have a string and I want to replace every capital 'I' with small 'i', and every small 'i' with a capital 'I'. As you can see if I do this in two stages it just converts it, then converts it back to how it was before. So how would I do it all at once?
<html>
<head>
<script type="text/javascript">
function init() {
text = document.getElementById('test');
newtext = text.innerHTML.replace(/I/g, "i");
newtext = newtext.replace(/i/g, "I");
text.innerHTML = newtext;
}
</script>
</head>
<body onload="init()">
<div id="test">
THIS IS SOME TEST
</div>
</body>
</html>