s*******z 发帖数: 422 | 1 var InputBox = $('#<%=TextBox1.ClientID%>');
这个语句用于一个master page下的content page上。
如果直接用在content page上就行,放在一个external js file 中就不起作用。哪位
专家给解释一下?多谢了! |
s***o 发帖数: 2191 | 2 The external .js file is not compiled as part of the page, thus, the
ClientID is not "translated" properly.
【在 s*******z 的大作中提到】 : var InputBox = $('#<%=TextBox1.ClientID%>'); : 这个语句用于一个master page下的content page上。 : 如果直接用在content page上就行,放在一个external js file 中就不起作用。哪位 : 专家给解释一下?多谢了!
|
s*******z 发帖数: 422 | 3 Thanks a lot! Is there any solution since I'd like to keep the codes clean?
Or I am stuck with writing the codes inside the content page?
【在 s***o 的大作中提到】 : The external .js file is not compiled as part of the page, thus, the : ClientID is not "translated" properly.
|
t*****s 发帖数: 124 | 4 pass this id as a parameter
?
【在 s*******z 的大作中提到】 : Thanks a lot! Is there any solution since I'd like to keep the codes clean? : Or I am stuck with writing the codes inside the content page?
|
s***o 发帖数: 2191 | 5 You could define your function in an external file, and pass the "<%= Id.
ClientID %>" as a parameter value when you call it in the page.
It's ok to me to have page-specific JS blocks inside a page.
btw, if you use JavaScript extensively, I suggest switching to ASP.NET MVC.
?
【在 s*******z 的大作中提到】 : Thanks a lot! Is there any solution since I'd like to keep the codes clean? : Or I am stuck with writing the codes inside the content page?
|
s*******z 发帖数: 422 | 6 目前我的JavaScript用的还不多,但是我越用越觉得它很不错。
因为不是专业程序员,所以担心switching to ASP.NET MVC 会很花时间和精力。
【在 s***o 的大作中提到】 : You could define your function in an external file, and pass the "<%= Id. : ClientID %>" as a parameter value when you call it in the page. : It's ok to me to have page-specific JS blocks inside a page. : btw, if you use JavaScript extensively, I suggest switching to ASP.NET MVC. : : ?
|
s*******z 发帖数: 422 | 7 var InputBox = $('#<%=TextBox1.ClientID%>');
这个语句用于一个master page下的content page上。
如果直接用在content page上就行,放在一个external js file 中就不起作用。哪位
专家给解释一下?多谢了! |
s***o 发帖数: 2191 | 8 The external .js file is not compiled as part of the page, thus, the
ClientID is not "translated" properly.
【在 s*******z 的大作中提到】 : var InputBox = $('#<%=TextBox1.ClientID%>'); : 这个语句用于一个master page下的content page上。 : 如果直接用在content page上就行,放在一个external js file 中就不起作用。哪位 : 专家给解释一下?多谢了!
|
s*******z 发帖数: 422 | 9 Thanks a lot! Is there any solution since I'd like to keep the codes clean?
Or I am stuck with writing the codes inside the content page?
【在 s***o 的大作中提到】 : The external .js file is not compiled as part of the page, thus, the : ClientID is not "translated" properly.
|
t*****s 发帖数: 124 | 10 pass this id as a parameter
?
【在 s*******z 的大作中提到】 : Thanks a lot! Is there any solution since I'd like to keep the codes clean? : Or I am stuck with writing the codes inside the content page?
|
s***o 发帖数: 2191 | 11 You could define your function in an external file, and pass the "<%= Id.
ClientID %>" as a parameter value when you call it in the page.
It's ok to me to have page-specific JS blocks inside a page.
btw, if you use JavaScript extensively, I suggest switching to ASP.NET MVC.
?
【在 s*******z 的大作中提到】 : Thanks a lot! Is there any solution since I'd like to keep the codes clean? : Or I am stuck with writing the codes inside the content page?
|
s*******z 发帖数: 422 | 12 目前我的JavaScript用的还不多,但是我越用越觉得它很不错。
因为不是专业程序员,所以担心switching to ASP.NET MVC 会很花时间和精力。
【在 s***o 的大作中提到】 : You could define your function in an external file, and pass the "<%= Id. : ClientID %>" as a parameter value when you call it in the page. : It's ok to me to have page-specific JS blocks inside a page. : btw, if you use JavaScript extensively, I suggest switching to ASP.NET MVC. : : ?
|
t********n 发帖数: 728 | 13 write the js code in the content page has nothing to do with "keep the code
clean".
In my opinion, you'd better put your js code in the page if jquery selector
is used in your way is a must
?
【在 s*******z 的大作中提到】 : Thanks a lot! Is there any solution since I'd like to keep the codes clean? : Or I am stuck with writing the codes inside the content page?
|