mychar.style.color="red";
mychar.style.backgroundColor="#CCC";
mychar.style.width="300px";
mychar.style.backgroundColor="#CCC";
mychar.style.width="300px";
2015-05-20
<form>
<input type="button" onClick = "showHint(setColor)" value="改變顏色" >
...
...
<input type="button" onclick="showHint(cancel)" value="取消設置" >
</form>
function showHint(fun)
{
var hint = confirm("確定要這樣做嗎?");
if(hint)
{
fun();
}
}
<input type="button" onClick = "showHint(setColor)" value="改變顏色" >
...
...
<input type="button" onclick="showHint(cancel)" value="取消設置" >
</form>
function showHint(fun)
{
var hint = confirm("確定要這樣做嗎?");
if(hint)
{
fun();
}
}
<script type="text/javascript">
var score = 80;
if(score>=60)
{
document.write("very good");
}
else
{
document.write("work harder");
}
</script>
var score = 80;
if(score>=60)
{
document.write("very good");
}
else
{
document.write("work harder");
}
</script>
2015-05-19
<script type="text/javascript">
function openWindow(){
var message=confirm();
if(message==true)
window.open('http//www.xianlaiwan.cn/','_blank','width=400px,height=500px,menubar=no,toolbar=no')
else
{null}
}
</script>
</head>
function openWindow(){
var message=confirm();
if(message==true)
window.open('http//www.xianlaiwan.cn/','_blank','width=400px,height=500px,menubar=no,toolbar=no')
else
{null}
}
</script>
</head>