moorej
moorej

Reputation: 527

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!

Upvotes: 0

Views: 78

Answers (3)

Jason Gennaro
Jason Gennaro

Reputation: 34855

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>

Upvotes: 2

Marcel
Marcel

Reputation: 28087

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)

Upvotes: 0

Jawad
Jawad

Reputation: 6672

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.

Upvotes: -1

Related Questions