查看: 1559|回复: 14
|
.net javascript popup window 的問題
[复制链接]
|
|
剛開始要用。NET來做新的東西
之前都習慣在ASP
想請問大家
我放一個image,想讓那些按這個image的人都會彈出一個新的small window
在ASP寫這樣就沒問題
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
function popUp(URL) {
day = new Date();
id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width=300,height=500');");
}
// End -->
</script>
</HEAD>
<BODY>
<form>
<input type=image src="images/5.jpg" >
</form>
</BODY>
</HTML>
[ 本帖最后由 Piyo 于 8-10-2007 04:02 PM 编辑 ] |
|
|
|
|
|
|
|

楼主 |
发表于 8-10-2007 03:56 PM
|
显示全部楼层
|
|
|
|
|
|
|

楼主 |
发表于 8-10-2007 03:58 PM
|
显示全部楼层
Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30456: 'javascript' is not a member of 'ASP.how2popup_aspx'.
Source Error:
| Line 26: <body MS_POSITI>Line 27: <form id="Form1" method="post" runat="server">Line 28: <asp mageButton id="ImageButton1" style="Z-INDEX: 102; LEFT: 72px; POSITION: absolute; TOP: 112px"Line 29: runat="server" ImageUrl="images/8010.jpg"></asp mageButton>Line 30: </form> |
Source File: c:\inetpub\wwwroot\WebApplication1\how2popup.aspx Line: 28
|
|
|
|
|
|
|
|
发表于 8-10-2007 04:51 PM
|
显示全部楼层
原帖由 Piyo 于 8-10-2007 03:56 PM 发表 
但是當我寫在ASP.NET 2.0 就有問題
zommok不要在code behind button click event 放那个code呢?  |
|
|
|
|
|
|
|

楼主 |
发表于 9-10-2007 09:15 AM
|
显示全部楼层
原帖由 PvIce 于 8-10-2007 04:51 PM 发表 
zommok不要在code behind button click event 放那个code呢?
我有試放﹐但是有error,所以後來人家說可以不用放,在CLIENT那邊執行比較好
你是。NET expert嗎﹖可以教教我我﹖
我昨天找到一個比較折衷的方法﹐就是不要用IMAGE/BUTTON﹐用a hyperlink ﹐然後ONLOAD_PAGE放
Hyperlink1.Attributes.Add("onclick", "window.open('popup.aspx',null,'height=250, width=250,status= no, resizable= no, scrollbars=no, toolbar=no,location=no,menubar=no ');"
這樣就可以執行﹐但是我顧客要求一一定要放圖片CLICK
你們還有什麼好方法嗎﹖謝謝 |
|
|
|
|
|
|
|
发表于 9-10-2007 04:56 PM
|
显示全部楼层
试试看这个方法
ClientScript.RegisterClientScriptBlock(Page.GetType, "Script", "window.open('xx.aspx');", True) |
|
|
|
|
|
|
|

楼主 |
发表于 9-10-2007 05:11 PM
|
显示全部楼层
原帖由 寻找自由的天空 于 9-10-2007 04:56 PM 发表 
试试看这个方法
ClientScript.RegisterClientScriptBlock(Page.GetType, "Script", "window.open('xx.aspx');", True)
so 我弄了一個imagebutton,then double click image 放了你說的CODE
然後我得到一個 Name 'ClientScript' is not declared
我有少做了什麼嗎﹖ 謝謝 |
|
|
|
|
|
|
|
发表于 9-10-2007 11:37 PM
|
显示全部楼层
lljjjjjjjjjjjk
加上ImageUrl就可以了
然后加上在page_load放上你之前的code
Hyperlink1.Attributes.Add("onclick", "window.open('popup.aspx',null,'height=250, width=250,status= no, resizable= no, scrollbars=no, toolbar=no,location=no,menubar=no ');" |
|
|
|
|
|
|
|
发表于 10-10-2007 03:24 PM
|
显示全部楼层
原帖由 Piyo 于 9-10-2007 09:15 AM 发表 
我有試放﹐但是有error,所以後來人家說可以不用放,在CLIENT那邊執行比較好
你是。NET expert嗎﹖可以教教我我﹖
我昨天找到一個比較折衷的方法﹐就是不要用IMAGE/BUTTON﹐用a hyperlink ﹐然後ONLOAD_P ...
我给你的是code behind ok? :)
Protected Sub ImageButton1_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
Response.Write("<script language='javascript'>window.open('叫出来的form名.aspx', 'CustomPopUp','width=724,status=no, height=600,scrollbars=yes, menubar=no, resizable=no')</script>")
End Sub |
|
|
|
|
|
|
|
发表于 11-10-2007 01:18 PM
|
显示全部楼层
原帖由 Piyo 于 9-10-2007 05:11 PM 发表 
so 我弄了一個imagebutton,then double click image 放了你說的CODE
然後我得到一個 Name 'ClientScript' is not declared
我有少做了什麼嗎﹖ 謝謝
我所给你的是code behind |
|
|
|
|
|
|
|

楼主 |
发表于 11-10-2007 04:03 PM
|
显示全部楼层
原帖由 lklow 于 9-10-2007 11:37 PM 发表 
lljjjjjjjjjjjk
加上ImageUrl就可以了
然后加上在page_load放上你之前的code
Hyperlink1.Attributes.Add("onclick", "window.open('popup.aspx',null,'height=250, width=250,status= no, resizable= no, sc ...
對不起﹗我不明白哦﹗ 加上ImageUrl就可以了﹖ |
|
|
|
|
|
|
|

楼主 |
发表于 11-10-2007 04:07 PM
|
显示全部楼层
|
|
|
|
|
|
|
发表于 11-10-2007 05:17 PM
|
显示全部楼层
|
|
|
|
|
|
|

楼主 |
发表于 16-10-2007 03:48 PM
|
显示全部楼层
謝謝樓上各位前輩
我想再問問關於把寫好的。net file 放上網上看得問題
1。如果我現在的website 是ASP的。然後如果我要deploy 我的。aspx file去網上﹐會不會有問題呢﹖
因為我的ASP file 都是放 在www folder裡面才會被執行的﹐所以當我想同樣把。net file放進去。但是我vs 2005 給我這樣得問題。The ~\www directory does not exist
所以﹐我想將App_Code, App_Data,還有default2.asp通通都放 www folder裡面,但是卻出現圖一的問題The ~\www directory does not exist
請知道的人指點﹐謝謝
可以了。。。test 到了﹐不用恢復這問題
[ 本帖最后由 Piyo 于 16-10-2007 04:31 PM 编辑 ] |
|
|
|
|
|
|
|

楼主 |
发表于 16-10-2007 04:06 PM
|
显示全部楼层
回复 #14 Piyo 的帖子
對了﹐debug有這個ERROR
this is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. |
|
|
|
|
|
|
| |
本周最热论坛帖子
|