Removing http:// prefix from ASP loaded URL [closed]

允我心安 提交于 2019-12-11 19:35:41

问题


My page here has advertisers' URLs listed in full, but I'm not sure how to remove the http:// prefix.

Here's the Code:

 <% if instr("abc"&rsAdvert("WebAddress"),"http:")>0 then
     shttp=""
 else
     shttp="http://" 
 %>
 <li class="weblink"> 
   | <a onclick="pageTracker._trackPageview('/TOP_FULL_ADVERT_WEBSITE/<%=shttp%><%=rsAdvert("WebAddress")%>');"
        href='<%=shttp%><%=rsAdvert("WebAddress")%>'
        target='_blank' rel='nofollow'>
    <%=rsAdvert("WebAddress")%></a></li>
<% end if %>

Any ideas would be great.


回答1:


Have you tried

var url = "your url";
url = url.replace("http://", "");



回答2:


You need to change this bit of your code:

<a href="url">text</a>
              ^^^^

You link looks like this:

<a 
    onclick="pageTracker._trackPageview('/TOP_FULL_ADVERT_WEBSITE/<%=shttp%><%=rsAdvert("WebAddress")%>');" 
    href='<%=shttp%><%=rsAdvert("WebAddress")%>' 
    target='_blank' 
    rel='nofollow'>
    <%=rsAdvert("WebAddress")%>
</a>

so you need to chnage the bit just before the </a>, specifically this bit at the end

><%=rsAdvert("WebAddress")%></a>
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^

to some variable which does not include the http://

this might work, not sure of classic asp syntax

 ><%=rsAdvert("WebAddress").replace("http://", "")%></a>


来源:https://stackoverflow.com/questions/19404517/removing-http-prefix-from-asp-loaded-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!