<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.xianlaiwan.cn','_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.xianlaiwan.cn','_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.xianlaiwan.cn/");
window.open(website,'_blank','width=900,height=500,menubar=no,toolbar=no');
}
}
var op=confirm("確定打開?");
if(op==true){
var website=prompt("輸入網站內容","http://www.xianlaiwan.cn/");
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.xianlaiwan.cn/");
if(website!=null)
{window.open('http://www.xianlaiwan.cn','_blank','width=400,height=500,menubar=no,toolbar=no); }
else
{ alert("再見!"); }
}
{
var open=confirm("確定打開窗戶嘛?");
if(open==true)
{var website=prompt("網站?", "http://www.xianlaiwan.cn/");
if(website!=null)
{window.open('http://www.xianlaiwan.cn','_blank','width=400,height=500,menubar=no,toolbar=no); }
else
{ alert("再見!"); }
}
function openWindow(){
var open=confirm("確認新建窗口打開網站嗎?");
if(open==true){
var url=prompt("通過輸入對話框,確定打開的網址","http://www.xianlaiwan.cn");
}
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.xianlaiwan.cn");
}
if(url!=null){
window.open(url,'_blank','width=400px,height=500px,menubar=no,toolbar=no');
}
else{
alert("再見!");
}
}