//定義"取消設置"的函數
function add5(){
var cl5=confirm("前面都是垃圾")
if(cl5==true){
con.removeAttribute('style');
txt.removeAttribute('style');
}
else{alert("over")
}
function add5(){
var cl5=confirm("前面都是垃圾")
if(cl5==true){
con.removeAttribute('style');
txt.removeAttribute('style');
}
else{alert("over")
}
<script type = "text/javascript">
var mymessage=confirm('你喜歡男人么');
if(mymessage==true){
document.write('很好');
} else {
document.write('不好');
}
var mymessage=confirm('你喜歡男人么');
if(mymessage==true){
document.write('很好');
} else {
document.write('不好');
}
2016-05-14
<script type = "text/javascript">
document.write();
</script>
document.write();
</script>
2016-05-14
document.getElementById('con')獲取的只是P標簽,
返回的是[object HTMLParagraphElement],
document.getElementById('con').innerHTML獲取的才是P標簽里的內容
返回的是[object HTMLParagraphElement],
document.getElementById('con').innerHTML獲取的才是P標簽里的內容
2016-05-14
“document.write can be a form of eval.”:“document.write是eval的一種形式”, eval要盡量避免,是出于安全考慮,因為eval過于強大,他可以把string串作為代碼執行。如果控制不好就會造成安全漏洞。
2016-05-14
function contxt()//定義函數
{
alert("哈哈。調用函數了!");
}
context();//調用函數
</script>
<form>
<input type="button" value="點擊我" onclick="context()"/>
</form>
</body>
</html>
{
alert("哈哈。調用函數了!");
}
context();//調用函數
</script>
<form>
<input type="button" value="點擊我" onclick="context()"/>
</form>
</body>
</html>
2016-05-14
function add5(){
var add5=confirm("是否取消設置?")
if(add5==true)
{
document.getElementById("txt").removeAttribute("style");
}
}
//為什么大神跟我寫的都不一樣
var add5=confirm("是否取消設置?")
if(add5==true)
{
document.getElementById("txt").removeAttribute("style");
}
}
//為什么大神跟我寫的都不一樣
//定義"隱藏內容"的函數
function hide(){
div.style.display = 'none';
}
//定義"顯示內容"的函數
function show(){
div.style.display = 'block';
}
//定義"取消設置"的函數
function cancel(){
if(confirm('是否取消設置?')){
h2.removeAttribute('style');
div.removeAttribute('style');
}
}
function hide(){
div.style.display = 'none';
}
//定義"顯示內容"的函數
function show(){
div.style.display = 'block';
}
//定義"取消設置"的函數
function cancel(){
if(confirm('是否取消設置?')){
h2.removeAttribute('style');
div.removeAttribute('style');
}
}