How can i set my web page title as rotating.
I have a page named "dog.aspx" and its title is "Dog Selection". I want this title to rotate continuously. How can i do this in ASP.net(C#).

Recommended Answers

What do you mean by "rotate"?
Do you want it to change to some other text in the browser while the user is looking at the page?

Jump to Post

How can i set my web page title as rotating.
I have a page named "dog.aspx" and its title is "Dog Selection". I want this title to rotate continuously. How can i do this in

Jump to Post

All 7 Replies

What do you mean by "rotate"?
Do you want it to change to some other text in the browser while the user is looking at the page?

no sergb. not that way. Let me give u an example.
When we put any text in <marquee></marquee tag it rotates I want rotation in that way.
I tried to put my title in <marquee> tag but it doesnt work.

I hope now u got my question

How can i set my web page title as rotating.
I have a page named "dog.aspx" and its title is "Dog Selection". I want this title to rotate continuously. How can i do this in ASP.net(C#).

Timer & document.title property.

<head runat="server">
    <title id="title1">Sample Text &nbsp;&nbsp;&nbsp;&nbsp;</title>
    
    <script type="text/javascript">
        var tid;
        var text = "Sample";
        window.onload = (function() {
            tid = setInterval(rotateText, 100);
        });
        function rotateText() {
           document.title = document.title.substring(1, document.title.length) + "" + document.title.substring(0, 1);
        } 
    </script>
</head>

Thanx ADATAPOST.
I got ur reply.
But freind this script will work only for title "Sample" that is static.
I want to make rotation of word which is written in between <title> tag.

Thanx ADATAPOST.
I got ur reply.
But freind this script will work only for title "Sample" that is static.
I want to make rotation of word which is written in between <title> tag.

<title><%=publicfield_or_propertyName %></title>

Thanx adapost
Can u give me completed code of it.

Default.aspx

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<script runat="server">
    string myTitle = "Sample Text";  
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title><%=myTitle %></title>
     
    <script type="text/javascript">
        var tid;
        var text = "<%=myTitle %>";
        window.onload = (function() {
            tid = setInterval(rotateText, 100);
        });
        function rotateText() {
           document.title = document.title.substring(1, document.title.length) + "" + document.title.substring(0, 1);
        } 
    </script>
</head>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    
    </div>
    </form>
</body>
</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.