我应该如何尝试在不进入 html 的情况下更改 aspx Web 表单中的链接

How should i attempt to change links in a aspx webform without going into the html

本文关键字:aspx Web 表单 链接 情况下 我应该 何尝试 html      更新时间:2023-09-26

>我有这段代码可以正常工作,但我想要的是链接是可更改的,而无需进入 html 级别。可能类似于带有文本框的 vb.net 表单,单击按钮后链接将替换我当前拥有的链接。

是否可以 vb.net 窗口窗体与 aspx.net 窗体链接?如果是,最佳方法是什么?

这是代码:

<script type="text/javascript">
<!--
var step=1
var whichimage=1
function slideit(){
if (!document.images)
return
document.images.slide.src=eval("image"+step+".src")
whichimage=step
if (step<3)
step++
else
step=1
setTimeout("slideit()",1800)
}
slideit()
function slidelink(){
if (whichimage==1)
window.location="http://www.google.com"
else if (whichimage==2)
window.location= "http://www.facebook.com"
else if (whichimage==3)
window.location="http://www.twitter.com"
}
//-->
</script>

试试这个

假设文本框是这样的

<input id="txtbx" type="text">

然后你可以像这样得到文本框的conatins。

function slidelink(){
if (whichimage==1)
window.location= document.getElementById('txtbx').value;
else if (whichimage==2)
window.location= document.getElementById('txtbx').value;
else if (whichimage==3)
window.location= document.getElementById('txtbx').value;
}