擴展我沒有構建的網站。我想能夠用參數調用ShowWindow proc。我會怎麼做?新的JQuery和Javascript。調用Javascript函數
default.aspx
<script type="text/javascript" src="/scripts/jquery-1.2.6.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('a#ShowWindow').click(function() {
window.open("TerminalInfo.aspx?", 'Info', 'scrollbars=yes,width=510,height=536');
})
});
default.aspx.cs
動態構建ASPX ...
public static string ToHtml(this Location location)
{
var html = new StringBuilder();
html.Append("<td><a href='#' id='ShowWindow'>ShowLetter</a></td>"); //This works
html.Append("<td><a href='#' id='ShowWindow(\"MyInfo.aspx\")'>Read More</a></td>"); //How can I do this? It doesn't work.
return html.ToString();
}
在我看來就像你正在編寫的代碼,你不明白。你也玩過裝槍嗎? –
@Josh Stodola:JavaScript比裝載槍更安全一些。每個人都必須在某個地方開始學習。 –
我認爲喬希的觀點是,他看起來像在他開始編寫代碼並提出問題之後纔開始rtfm。 JavaScript中的事件已被過度記錄。 –