<form>
<input type="button" value="点击我" onclick=" contxt() " />
</form>
<input type="button" value="点击我" onclick=" contxt() " />
</form>
2019-08-28
完美!成功实现!
<script type="text/javascript">
function openWindow(){
var windownew=confirm("将打开新窗口,是否确认?");
if(windownew==true)
{window.open('http://www.imooc.com','_blank','width=400,height=500,menubar=no,toolbar=no')}
else
{null}
}
</script>
<script type="text/javascript">
function openWindow(){
var windownew=confirm("将打开新窗口,是否确认?");
if(windownew==true)
{window.open('http://www.imooc.com','_blank','width=400,height=500,menubar=no,toolbar=no')}
else
{null}
}
</script>
<input type="button" onclick=cancer() value="取消设置" >
function cancer(){
var message=confirm("取消操作?")
if( message == true)
{txt.removeAttribute("style");}
else
{return}
}
function cancer(){
var message=confirm("取消操作?")
if( message == true)
{txt.removeAttribute("style");}
else
{return}
}
其他功能:
function changeColor(){
text.style.color="blue";
}
//定义"改变宽高"的函数
function changeWAndH(){
text.style.width="100";
text.style.height="200";
}
//定义"隐藏内容"的函数
function hide(){
text.style.display="none";
}
//定义"显示内容"的函数
function display(){
text.style.display="block";
}
function changeColor(){
text.style.color="blue";
}
//定义"改变宽高"的函数
function changeWAndH(){
text.style.width="100";
text.style.height="200";
}
//定义"隐藏内容"的函数
function hide(){
text.style.display="none";
}
//定义"显示内容"的函数
function display(){
text.style.display="block";
}
//全局变量,读取txt对象
var text = document.getElementById("txt");
//定义"取消设置"的函数
function cancel(){
var is = confirm("确认取消设置?");
if(is==true){
text.removeAttribute("style");
}
}
var text = document.getElementById("txt");
//定义"取消设置"的函数
function cancel(){
var is = confirm("确认取消设置?");
if(is==true){
text.removeAttribute("style");
}
}
function openWindow(){
var op=confirm("确定打开?");
if(op==true){
var website=prompt("输入网站内容","http://www.imooc.com/");
window.open(website,'_blank','width=900,height=500,menubar=no,toolbar=no');
}
}
var op=confirm("确定打开?");
if(op==true){
var website=prompt("输入网站内容","http://www.imooc.com/");
window.open(website,'_blank','width=900,height=500,menubar=no,toolbar=no');
}
}
function openwindow()
{
var open=confirm("确定打开窗户嘛?");
if(open==true)
{var website=prompt("网站?", "http://www.imooc.com/");
if(website!=null)
{window.open('http://www.imooc.com','_blank','width=400,height=500,menubar=no,toolbar=no); }
else
{ alert("再见!"); }
}
{
var open=confirm("确定打开窗户嘛?");
if(open==true)
{var website=prompt("网站?", "http://www.imooc.com/");
if(website!=null)
{window.open('http://www.imooc.com','_blank','width=400,height=500,menubar=no,toolbar=no); }
else
{ alert("再见!"); }
}
function openWindow(){
var open=confirm("确认新建窗口打开网站吗?");
if(open==true){
var url=prompt("通过输入对话框,确定打开的网址","http://www.imooc.com");
}
if(url!=null){
window.open(url,'_blank','width=400px,height=500px,menubar=no,toolbar=no');
}
else{
alert("再见!");
}
}
var open=confirm("确认新建窗口打开网站吗?");
if(open==true){
var url=prompt("通过输入对话框,确定打开的网址","http://www.imooc.com");
}
if(url!=null){
window.open(url,'_blank','width=400px,height=500px,menubar=no,toolbar=no');
}
else{
alert("再见!");
}
}