function hidetext()
{
var mychar = document.getElementById("con").style.display="none";
}
function showtext()
{
var mychar = document.getElementById("con").style.display="block";
}
{
var mychar = document.getElementById("con").style.display="none";
}
function showtext()
{
var mychar = document.getElementById("con").style.display="block";
}
2016-03-27
<script type="text/javascript">
function add(){
var p1 = document.getElementById("p1");
p1.className="one"
}
function modify(){
var p2 = document.getElementById("p2");
p2.className="one"
}
</script>
function add(){
var p1 = document.getElementById("p1");
p1.className="one"
}
function modify(){
var p2 = document.getElementById("p2");
p2.className="one"
}
</script>
2016-03-27
function Wopen(){
var xinbox=confirm("是否新建窗口?");
var ttcaa=prompt("请输入网址","http://www.imooc.com");
if(xinbox==true&&ttcaa=="http://www.imooc.com"){
window.open(ttcaa,'_blank','width=600,height=500,left=100,top=100')
}
else{
alert("你没有打开窗口!")
document.write("你为啥不打开慕课网?")
}
}
var xinbox=confirm("是否新建窗口?");
var ttcaa=prompt("请输入网址","http://www.imooc.com");
if(xinbox==true&&ttcaa=="http://www.imooc.com"){
window.open(ttcaa,'_blank','width=600,height=500,left=100,top=100')
}
else{
alert("你没有打开窗口!")
document.write("你为啥不打开慕课网?")
}
}
2016-03-27
function Wopen(){
var xinbox=confirm("是否新建窗口?")
if(xinbox==true){
var ttcaa=prompt("请输入网址","http://www.imooc.com")
window.open(ttcaa,'_blank','width=600,height=500,left=100,top=100')
}
else{
alert("你没有打开窗口!")
document.write("你为啥不打开窗口?")
}
var xinbox=confirm("是否新建窗口?")
if(xinbox==true){
var ttcaa=prompt("请输入网址","http://www.imooc.com")
window.open(ttcaa,'_blank','width=600,height=500,left=100,top=100')
}
else{
alert("你没有打开窗口!")
document.write("你为啥不打开窗口?")
}
2016-03-27
function 函数名()
{
函数代码;
}
说明:
1. function定义函数的关键字。
2. "函数名"你为函数取的名字。
3. "函数代码"替换为完成特定功能的代码。
完成function函数后一定要记得调用函数,否则不出现结果。
{
函数代码;
}
说明:
1. function定义函数的关键字。
2. "函数名"你为函数取的名字。
3. "函数代码"替换为完成特定功能的代码。
完成function函数后一定要记得调用函数,否则不出现结果。
2016-03-27
function rec(){
var score; //score变量,用来存储用户输入的成绩值。
score = prompt("请输入你的基情值!");
if(score>=90)
{
document.write("你很棒!");
}
else if(score>=75)
{
document.write("不错吆!");
}
else if(score>=60)
{
document.write("要加油!");
}
else
{
document.write("要努力了!");
}
}
var score; //score变量,用来存储用户输入的成绩值。
score = prompt("请输入你的基情值!");
if(score>=90)
{
document.write("你很棒!");
}
else if(score>=75)
{
document.write("不错吆!");
}
else if(score>=60)
{
document.write("要加油!");
}
else
{
document.write("要努力了!");
}
}
2016-03-27
innerHTML 属性用于获取或替换 HTML 元素的内容。
语法:
Object.innerHTML
注意:
1.Object是获取的元素对象,如通过document.getElementById("ID")获取的元素。
2.注意书写,innerHTML区分大小写。
语法:
Object.innerHTML
注意:
1.Object是获取的元素对象,如通过document.getElementById("ID")获取的元素。
2.注意书写,innerHTML区分大小写。
2016-03-27
var mychar=document.getElementById("con"); 获取的是一个名叫con的对象,所以输出是[object HTMLParagraphElement]。如果要输出con里的内容,则为var mychar=document.getElementById("con").innerHTML;
2016-03-27