IBM WebSphere Application Server中的<a href=""> with #scrollid and a GET variable

时间:2017-05-22 07:19:54

标签: php html get

I hope someone can help me with this problem. I'm trying to give this href an GET id, but the url alreay has a #scrollid what means it will scroll to a the place on the page where the #scrollid is. but whenever I try to add an GET id to the url the #scrollid doesn't work anymore.

<a href="<?php echo $site_url, 'contact#scrollid?title=', 
$data['page']['slug']?>"Deelnemen</a>

1 个答案:

答案 0 :(得分:1)

数字符号(#)后不发送到服务器和浏览器。所以先写get参数,然后添加#。浏览器认为#之后的所有字符都是元素ID。

<a href="<?php echo $site_url.'contact?title='.$data['page']['slug'].'#scrollid' ?>" >
  Deelnemen
</a>