我是asp.net用于制作网站的新手.所以我在理解以下内容之间的区别时遇到了一些麻烦.asp:Button和输入按钮有什么区别?
代码1
aspx代码
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
Run Code Online (Sandbox Code Playgroud)
代码隐藏
protected void Button1_Click(object sender, EventArgs e)
{
//Do somthing
}
Run Code Online (Sandbox Code Playgroud)
代码2
aspx代码
<input id="Submit1" type="submit" value="submit" onclick="return Submit1_onclick()" />
<script language="javascript" type="text/javascript">
// <![CDATA[
function Submit1_onclick() {
//Do somthing
}
// ]]>
</script>
Run Code Online (Sandbox Code Playgroud) 这是我的代码,但它不起作用.
<!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" xml:lang="en" lang="en">
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script src="http://api.wipmania.com/jsonp?callback.js"></script>
<script type="text/javascript">
switch(country_code()){
case "IN" :
document.location.href = "http://xxxxxxxx.biz/theme.php";
break;
}
</script>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
</html>
Run Code Online (Sandbox Code Playgroud)
我想检测用户的国家/地区并适当地重定向它们.
我需要将此字符串拆分为此字符串的任何$$:
String tmpHash = "NA$notValid-1$notValid-2##notValid-3##$$VALID-1##$$VALID-2##$notvalid-4$$VALID-3";
Run Code Online (Sandbox Code Playgroud)
这是我的代码:
String[] arr=tmpHash.split("$$");
for (int i = 0; i < arr.length; i++) {
System.out.println("OUTPUT--> "+arr[i]);
}
Run Code Online (Sandbox Code Playgroud)
输出是
OUTPUT--> NA$notValid-1$notValid-2##notValid-3##$$VALID-1##$$VALID-2##$notvalid-4$$VALID-3
Run Code Online (Sandbox Code Playgroud)
期望的输出
OUTPUT-->NA$notValid-1$notValid-2##notValid-3##
OUTPUT-->VALID-1##
OUTPUT-->VALID-2##$notvalid-4
OUTPUT-->VALID-3
Run Code Online (Sandbox Code Playgroud)