TutorialToday, I made a Tab. I used JavaScript + Div to complete it. <ul> </ul> cannot be used to store layers. I cannot call the paging class to perform datalist paging, so I thought about the AJAx control. I heard it was good to use it. I thought it could solve my problem. I didn't expect it to bring me more trouble. First, the style cannot be changed, which is my biggest headache. Another thing is to use it. JS conflicts with it. That is to say, if Ajax is used, JavaScript cannot be used. Even a "Hello World" pop-up is a problem and it is painful for me to die. I checked and found out how to pop up the window, pass the value, and solve the problem of jumping out of the framework. The following is a summary:
Ajax pop-up window
There is an UpdatePanel control on the page, so you cannot use JavaScript?
Use ScriptManager
ScriptManager. RegisterClientScriptBlock (this. up1, GetType (), "add", "window. open ('default2. aspx ');", true );
This. up1 this is the ID of the UpdatePanel Control
The last parameter is set to false when there are two tags: <script language = 'javascript '> </script>. Otherwise, the value is true.
Pop-up message box:
ScriptManager. RegisterClientScriptBlock (UpdatePanel1, this. GetType (), "click", "alert (" prompt message ")", true );
The following method is acceptable. If you are interested, try it.
Public static string _ alert (string alertMessage)
{
StringBuilder _ sb = new StringBuilder ();
_ Sb. Append ("<script type = \" text/javascript \ "> ");
_ Sb. Append ("alert (\" "+ alertMessage + "\");");
_ Sb. Append ("</script> ");
Return _ sb. ToString ();
}
You need to import using. System. Text;
This is used in the page:
Page. ClientScript. RegisterClientScriptBlock (this. GetType (), "XXXX", className. _ alert ("XXXX "));
Alas, it seems that it is quite similar to JS. Well, I will use it to pass down the value,
ScriptManager. RegisterClientScriptBlock (UpdatePanel1, typeof (UpdatePanel), "test", "parent.doc ument. location. href = 'myquestion. aspx? Id = "+ QuestionID +" '; ", true );
The test is passed. Haha
No-refreshing ajax pop-up message box
<! DOCTYPE html PUBLIC "-// W3C // DTD XHTML 1.0 Transitional // EN" "> http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns = "http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv = "Content-Type" content = "text / html; charset = gb2312" />
<title> The home of the helper_bkjia.com </ title>
<script>
var GW = screen.width;
var GH = screen.height;
function message () {
var oMessage = document.createElement ("div");
oMessage.name = "message";
oMessage.id = "message";
document.body.appendChild (oMessage);
var iMessage = document.getElementById ("message");
iMessage.style.position = "absolute";
iMessage.style.border = "1px solid #CCCCCC";
iMessage.style.background = "# F6F6F6";
var i = 0;
iMessage.style.left = (GW-i * i * 4) / 2 + "px";
iMessage.style.top = (GH / 2-100-i * i) + "px";
iMessage.style.width = i * i * 4 + "px";
iMessage.style.height = i * i * 2 + "px";
popMessage (i);
}
function popMessage (i) {
var iMessage = document.getElementById ("message");
iMessage.style.left = (GW-i * i * 4) / 2 + "px";
iMessage.style.top = (GH / 2-100-i * i) + "px";
iMessage.style.width = i * i * 4 + "px";
iMessage.style.height = i * i * 2 + "px";
if (i <= 10) {
i ++;
setTimeout ("popMessage (" + i + ")", 10);
}
}
function jump () {
location.href = "";
}
</ script>
</ head>
<body id = "c">
<input type = "button" onclick = "message ()" value = "post" />
<input type = "button" onclick = "jump ()" value = "jump" />
</ body>
</ html>
Tip: You can run the code after modification!
============= ↑ Article content display ↑ =============