我想开始说我对编程非常陌生。我正在开发一个具有多个超链接的站点(www.example.com
)。
当用户访问我的网站时,我希望将所有链接默认为我使用的其他网站(www.tvcmatrix.com/mhammonds
)的后台。如何根据我网站上的表单(www.example.com
)中的输入文本将链接设置为重定向到查询字符串值?
换句话说,如果网址为www.example.com/?user=abelliard
,我如何将网站上的所有链接更改为" www.tvcmatrix.com/abelliard"?如果没有查询字符串,那么我希望链接为www.tvcmatrix.com/mhammonds
。
以下是我网站上名为" form.asp"
的表单的文件<!DOCTYPE html>
<html>
<body>
<form action="viral.asp" method="get" name="input" target="_self">
Your TVC Matrix Associate ID: <input type="text" name="user" />
<input type="submit" value="Submit" />
</form>
</body>
</html>
这是&#34; viral.asp&#34;文件在&#34; form.asp&#34;文件。
<%@ language="javascript"%>
<!DOCTYPE html>
<html>
<body>
<%
var id = Request.QueryString("user");
Response.Write("Your URL is: www.mca.com/?user=" + id)
%>
</body>
</html>
答案 0 :(得分:-1)
如果查询字符串为空(“”),您可以使用if语句并将值设置为mhammonds
<%
Dim id = Request.QueryString("user")
Dim url = id
If id = "" Then
url = "mhammonds"
End If
'Every URL in your site reads
Response.Write "www.tvcmatrix.com/" & id
%>
`