已采纳回答 / 哈尼露易丝
按照我们的书写习惯,我们通常把javascript标签放到头部,比如这样<...code...>但是也有一说,由于html中的js是按顺序加载的,如果js没有加载就会阻塞后面的html加载,所以考虑到网页载入流畅,应该把javascript放到最后面。一般来说位置放哪里都可以,主要看实际情况可以怎么放更加优化性能等了望采纳!
2016-06-03
没效果是因为对象名错了:hidetext.style.display="none";改为mychar.style.display="none"; 基础不扎实吖!朋友加油!
2016-06-03
function openWindow(){
var ope;
// 新窗口打开时弹出确认框,是否打开
ope=confirm("确认要打开新窗口?");
if(ope==true){
window.open('http://www.imooc.com','_blank','width=400,height=500,menubar=no,toolbar=no');
}
}
var ope;
// 新窗口打开时弹出确认框,是否打开
ope=confirm("确认要打开新窗口?");
if(ope==true){
window.open('http://www.imooc.com','_blank','width=400,height=500,menubar=no,toolbar=no');
}
}
function display(){
var d=document.getElementById("txt")
d.style.display="block"
};
function cancel()
{
var tips = confirm('是否取消设置');
if(tips==true)
{
txt.removeAttribute('style');
}
}
var d=document.getElementById("txt")
d.style.display="block"
};
function cancel()
{
var tips = confirm('是否取消设置');
if(tips==true)
{
txt.removeAttribute('style');
}
}
function color(){
var a=document.getElementById("txt");
a.style.color="red"};
function wh(){
var b=document.getElementById("txt");
b.style.width="500px";b.style.height="500px"};
function hide(){
var c=document.getElementById("txt");
c.style.display="none"
};
var a=document.getElementById("txt");
a.style.color="red"};
function wh(){
var b=document.getElementById("txt");
b.style.width="500px";b.style.height="500px"};
function hide(){
var c=document.getElementById("txt");
c.style.display="none"
};
mychar.style.color="red"
mychar.style.fontSize="20px";
mychar.style.backgroundColor="black"
mychar.style.width="300px"
宽度字体得加单位
mychar.style.fontSize="20px";
mychar.style.backgroundColor="black"
mychar.style.width="300px"
宽度字体得加单位
2016-06-02