Transforming the Title Element's Text
Is it possible to "reflect" the title text of the browser window? For example the word "mirror" would become "rorrim" with the characters also facing the opposite direction. It's OK if it doesn't 开发者_运维技巧work in every browser, but asking the user to install something isn't an option.
Thanks!
If you are not opposed to plain javascript, you could add this after the title
tag. Make sure to give the title
an id
of title.
<script type="text/JavaScript">
var title = document.getElementById("title").innerHTML;
var titlechange = title.split('').reverse().join('');
var title = document.getElementById("title").innerHTML = titlechange;
</script>
The following uses the value from an input
field and outputs it's value concatenated with it's value reversed.
String.prototype.reverse = function() {
return this.split('').reverse().join('');
};
$("#wintitle").keyup(function(){
var newtitle = $(this).val() + ' - ' + $(this).val().reverse();
document.title = newtitle;
$("#output span").html(document.title);
});
Demo: jsfiddle.net/42umy (edit)
The title text cannot be styled in any way. In IE9, however there is a plugin called classic shell It wont do what you are asking though.
精彩评论