如何从我的网站打开网页

编程入门 行业动态 更新时间:2024-10-10 13:16:21
本文介绍了如何从我的网站打开网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大事记, 我如何用C#代码从网站上打开网页,例如在按钮控件的Onclick方法中,我使用了JavaScript来构建网页,而ActionScript是Coldfusion. Javascript和ActionScript具有"getURL()"功能,而Coldfusion具有"cflocation"标记: Javascript和ActionScript:

Greatings, How I can open a web page from my website on the C# code, for example in a Onclick method of an button control, i used build web pages with JavaScript too Coldfusion with ActionScript. Javascript and ActionScript have "getURL()" function, and Coldfusion has "cflocation" tag: Javascript and ActionScript:

getURL("Page1.html");

Coldfusion:

Coldfusion:

<cflocation url="Page1.cfm">

我有Visual Studio 2008 ------------------------------------------- 我正在尝试使用按钮单击导航到新网页.我使用了Christian Graus建议的RegisterClientScriptBlock方法,非常感谢,但是getURL()函数不起作用:

I have Visual Studio 2008 ------------------------------------------- I''m trying to navigate to a new webpage using a button click. I used RegisterClientScriptBlock method that Christian Graus suggest, Thanks very much, but the getURL() function not work:

protected void Button1_Click(object sender, EventArgs e) { ClientScriptManager myClientScriptManager = Page.ClientScript; myClientScriptManager.RegisterClientScriptBlock(this.GetType(), "Script1", "getURL(''Page1.aspx'');", true); }

---------------------------------------- 跌宕起伏!很抱歉,是的,getURL是来自ActionScript的,而window.open是来自JavaScript的,我很困惑.感谢Christian Graus,我的代码可以这样工作:

---------------------------------------- Upsss!! so sorry, yes getURL is from ActionScript and window.open from JavaScript, I was confused. Thanks Christian Graus, my code work so:

protected void Button1_Click(object sender, EventArgs e) { ClientScriptManager myClientScriptManager = Page.ClientScript; myClientScriptManager.RegisterClientScriptBlock(this.GetType(), "Script1", "window.open(''Page1.aspx'', ''_top'');", true); }

非常感谢您的帮助:thumbsup :: thumbsup :: thumbsup:

Thanks Very much for your help:thumbsup::thumbsup::thumbsup:

推荐答案

写道:

如何使用C#代码从我的网站打开网页,

How I can open a web page from my website on the C# code,

我假设您正在使用ASP.NET? Javascript和Actionscript在客户端计算机上运行. C#在服务器上运行.使用C#进行此操作的唯一方法是使用RegisterClientScriptBlock方法添加脚本(可能是对window.open的调用)来将JavaScript注入页面中.

I assume you''re using ASP.NET ? Javascript and Actionscript run on the client machine. C# runs on the server. The only way to do this with C# is to inject javascript to do it into the page, using the RegisterClientScriptBlock method to add the script, presumably a call to window.open.

getURL不会用Javascript打开一个新页面. window.open可以做到这一点. getURL does NOT open a new page in Javascript. window.open does that.

是的,我使用ASP .NET. BUt C#具有和相似的功能吗? Yes, I use ASP .NET. BUt C# has and function similar?

更多推荐

如何从我的网站打开网页

本文发布于:2023-11-27 18:53:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1639202.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:打开网页   网站

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!