duanao3204
duanao3204
2017-09-20 15:04

如何通过弹出框标题动态替换页面标题? [关闭]

My index page contains popup box. I want to replace index page title by popup box title if popup box clicked.

For example

<title><?php echo $title?></title>

I want to display as following:

<?php
    if(condition){      (->*such as #model2 is clicked*)
        $title="Model2 Section";
    }
    else{
        $title="Home"
    }
?>

I have used popup box as following:-> (link for popup box)

<article>
<a href="#modal2" class="dsnbutton ybank" id="pop_button">Model 2</a>
</article>

popup box

<div class="remodal" data-remodal-id="modal2" role="dialog" aria-labelledby="modal2Title" aria-describedby="modal2Desc">

How to change title ? Any Idea.

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • duanmo5724 duanmo5724 4年前

    You can do this in JavaScript with document.title = "new title"

    点赞 评论 复制链接分享

为你推荐