在线等JQuery答案

[复制链接]
查看11 | 回复1 | 2011-2-24 03:20:50 | 显示全部楼层 |阅读模式
1)新建一个网页,插入一个按钮和一个表格,1行1列,尺寸400*300px,表格内随便写一些文字,修改表格的style属性将该表格隐藏。
2)在代码模式下使用$(document).ready的方法为按钮增加click方法,并实现点击该按钮后弹出一个Dialog,该Dialog的内容是前面的隐藏表格。
需要注意的是,按钮点击后不要提交表单,同时不要把dialog的方法加到按钮的onclick方法中。
回复

使用道具 举报

千问 | 2011-2-24 03:20:50 | 显示全部楼层
<pre id=\\\"best-answer-content\\\" class=\\\"reply-text mb10\\\">!DOCTYPE html PUBLIC \\\"-//W3C//DTD XHTML 1.0 Transitional//EN\\\" \\\"<a href=\\\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\\\" target=\\\"_blank\\\">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</a>\\\"
html xmlns=\\\"<a href=\\\"http://www.w3.org/1999/xhtml\\\" target=\\\"_blank\\\">http://www.w3.org/1999/xhtml</a>\\\"
head
meta http-equiv=\\\"Content-Type\\\" content=\\\"text/html; charset=utf-8\\\" /
script type=\\\"text/javascript\\\" src=\\\"jquery1.5.min.js\\\"/script
script type=\\\"text/javascript\\\" src=\\\"jquery-ui-1.8.9.custom.min.js\\\"/script
script type=\\\"text/javascript\\\"
//![CDATA[
$(function(){
$(\\\"#dialog\\\").dialog({

autoOpen: false,

modal:true,

title:\\\"enozoom.com\\\",

minWidth:640,

resizable:false,
buttons:{\\\"提交\\\":function(){
//写一些内容
$(\\\"form\\\").submit();
},\\\"取消\\\":function(){$(\\\"#dialog\\\").dialog(\\\"close\\\");}}
});
$(\\\"#btn_open_dialog\\\").click(function(){$(\\\"#dialog\\\").dialog(\\\"open\\\") })
})
//]]
/script
/head
body
form action=\\\"\\\" method=\\\"post\\\"
div id=\\\'dialog\\\'
textarea不需要设定样式也会自动隐藏,只要声明在dialog内!/textarea
/div
button type=\\\"button\\\" id=\\\"btn_open_dialog\\\"弹出/button
/form
/body
/html











参考资料:<span class=\\\"gray\\\"><a href=\\\"http://www.enozoom.com\\\" target=\\\"_blank\\\">http://www.enozoom.com</a></span>
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行