HTML something Related

http://www.w3school.com.cn/tags/tag_button.asp

HTML <button> 标签

定义和用法

<button> 标签定义一个按钮。

在 button 元素内部,您可以放置内容,比如文本或图像。这是该元素与使用 input 元素创建的按钮之间的不同之处。

<button> 控件 与 <input type="button"> 相比,提供了更为强大的功能和更丰富的内容。<button> 与 </button> 标签之间的所有内容都是按钮的内容,其中包括任何可接受的正文内容,比如文本或多媒体内容。例如,我们可以在按钮中包括一个图像和相关的文本,用它们在按钮中创建一个吸引人的标记图像。

唯一禁止使用的元素是图像映射,因为它对鼠标和键盘敏感的动作会干扰表单按钮的行为。

请始终为按钮规定 type 属性。Internet Explorer 的默认类型是 "button",而其他浏览器中(包括 W3C 规范)的默认值是 "submit"。

实例

以下代码标记了一个按钮:

<button type="button">Click Me!</button>

TIY

浏览器支持

所有主流浏览器都支持 <button> 标签。

重要事项:如果在 HTML 表单中使用 button 元素,不同的浏览器会提交不同的值。Internet Explorer 将提交 <button> 与 <button/> 之间的文本,而其他浏览器将提交 value 属性的内容。请在 HTML 表单中使用 input 元素来创建按钮。

HTML 与 XHTML 之间的差异

NONE

可选的属性

属性 描述 DTD
disabled disabled 规定禁用此按钮。 STF
name name 规定按钮的名称。 STF
type
  • button
  • reset
  • submit
规定按钮的类型。 STF
value text 规定按钮的初始值。 STF

标准属性

id, class, title, style, dir, lang, xml:lang, accesskey, tabindex

如需完整的描述,请访问标准属性

事件属性

onfocus, onblur, onclick, ondblclick, onmousedown, onmouseup, 
onmouseover, onmousemove, onmouseout, onkeypress, onkeydown, onkeyup

如需完整的描述,请访问事件属性



php的curl实现get和post

原帖地址:http://www.chinaz.com/program/2008/1011/40499.shtml

类似于dreamhost这类主机服务商,是显示fopen的使用的。使用php的curl可以实现支持FTP、FTPS、HTTP HTPPS SCP SFTP TFTP TELNET DICT FILE和LDAP。curl 支持SSL证书、HTTP POST、HTTP PUT 、FTP 上传,kerberos、基于HTT格式的上传、代理、cookie、用户+口令证明、文件传送恢复、http代理通道就最常用的来说,是基于http的get和post方法。

代码实现:

1、http的get实现

$ch = curl_init("/") ;
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true) ;
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true) ;
$output = curl_exec($ch) ;
$fh = fopen("out.html", 'w') ;
fwrite($fh, $output) ;
fclose($fh) ;

2、http的post实现

//extract data from the post
extract($_POST) ;  
//set POST variables
$url = '/get-post.php' ;
$fields = array(
                        'lname'=&gt;urlencode($last_name) ,
                        'fname'=&gt;urlencode($first_name) ,
                        'title'=&gt;urlencode($title) ,
                        'company'=&gt;urlencode($institution) ,
                        'age'=&gt;urlencode($age) ,
                        'email'=&gt;urlencode($email) ,
                        'phone'=&gt;urlencode($phone)
                );  
//url-ify the data for the POST
foreach($fields as $key=&gt;$value) { $fields_string .= $key.'='.$value.'&amp;' ; }
rtrim($fields_string ,'&amp;') ; 
//open connection
$ch = curl_init() ; 
//set the url, number of POST vars, POST data
curl_setopt($ch, CURLOPT_URL,$url) ;
curl_setopt($ch, CURLOPT_POST,count($fields)) ;
curl_setopt($ch, CURLOPT_POSTFIELDS,$fields_string) ; 
//execute post
$result = curl_exec($ch) ; 
//close connection
curl_close($ch) ;


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值