这样才比较合理吧
function rec(){
var score=prompt("请输入你的成绩:");
if(score>=75&&score<=100)
{
document.write("你很棒!");
}else if(score>=0&&score<75)
{
document.write("要加油!");
}
else if(/[0-9]+/.test(score))
{
document.write("数字 不符合 规范");
}
else
{
document.write("请输入数字!");
}
}
function rec(){
var score=prompt("请输入你的成绩:");
if(score>=75&&score<=100)
{
document.write("你很棒!");
}else if(score>=0&&score<75)
{
document.write("要加油!");
}
else if(/[0-9]+/.test(score))
{
document.write("数字 不符合 规范");
}
else
{
document.write("请输入数字!");
}
}
2016-06-03
function y(){
if(confirm("你很谦虚啊?")==true)
alert("撒谎!");
else
alert("恭喜你,答对了!");
}
function rec(){
var mymessage=confirm("你觉得自己颜值高吗?");
if(mymessage==true)
{
y();
}
else
{
alert("有自知之明!");
}
}
if(confirm("你很谦虚啊?")==true)
alert("撒谎!");
else
alert("恭喜你,答对了!");
}
function rec(){
var mymessage=confirm("你觉得自己颜值高吗?");
if(mymessage==true)
{
y();
}
else
{
alert("有自知之明!");
}
}
2016-06-03
语法:
Object.style.display = value
value取值:
none隐藏
block显示
Object.style.display = value
value取值:
none隐藏
block显示
2016-06-03
backgroundColor:背景 font:字体属性
height:高度 fontFamily:元素的字体系列
width:宽度 fontSize:字体大小
color:文本颜色
height:高度 fontFamily:元素的字体系列
width:宽度 fontSize:字体大小
color:文本颜色
2016-06-03
已采纳回答 / 哈尼露易丝
按照我们的书写习惯,我们通常把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"
};