打开/关闭搜索
搜索
打开/关闭菜单
通知
打开/关闭个人菜单
查看“Java script”的源代码
来自OSSmedia
查看
阅读
查看源代码
查看历史
associated-pages
页面
讨论
更多操作
←
Java script
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
[[分类:编程]] ==替换页面文本== <p id="pn" >待替换文本</p> <script language="javascript" type="text/javascript"> var str = "替换的文本内容"; document.getElementById("pn").innerHTML = str; } </script> ==timer函数== <p id="pn" >时间</p> <script language="javascript" type="text/javascript"> cd(); setInterval(cd,1000); function cd() { var oDate = new Date(); var str = oDate.getHours() +":"+oDate.getMinutes()+":"+oDate.getSeconds(); document.getElementById("pn").innerHTML = "time:"+str; } </script> == 高考倒计时 == <syntaxhighlight lang="html" line="1"> <html> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>高考倒计时</title> <meta name="viewport" content="target-densitydpi=device-dpi, width=480px, user-scalable=no" /> <style type="text/css"> .jsfont{ font-size: 6rem; color:crimson; text-shadow:5px 2px 6px #000 ; font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif; } .jsTitlfont{ font-size:4ex; color:rebeccapurple; text-shadow:2px 1px 3px #000 ; font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif; } .roundZoneDark { border: 4px solid crimson; background-color:crimson; font-size:4rem; color:white; font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif; -moz-border-radius: 15px; /* Gecko browsers */ -webkit-border-radius: 15px; /* Webkit browsers */ border-radius:15px; /* W3C syntax */ box-shadow:5px 2px 6px #000 ; } </style> <body > <table width=98%> <tr><td align="center"><div class="roundZoneDark">高考倒计时</div></td></tr> <tr><td align="center"><div class="jsfont"><p id="pn" >剩余时间</p></div></td></tr> <script language="javascript" type="text/javascript"> var dateGK = new Date(2022,6,6,1,1,1,1); cd(); setInterval(cd,1000); function cd() { var oDate = new Date(); var str = oDate.getHours() +":"+oDate.getMinutes()+":"+oDate.getSeconds(); var gkDay = parseInt( (dateGK-oDate)/24/3600/1000); var gkHour = parseInt( (dateGK-oDate)/3600/1000%24); var gkmin = parseInt( (dateGK-oDate)/1000/60%60); var gksencond = parseInt( (dateGK-oDate)/1000%60); document.getElementById("pn").innerHTML = gkDay.toString()+"天"+gkHour.toString()+"时"+gkmin.toString()+"分"+gksencond.toString()+"秒"; } </script> </table> </body> </html> </syntaxhighlight> == 响应按钮点击 == <div class="button" height="80px" id="pn"> 新开始 </div> <input type="button" value="java test" onclick="startflag()" class="roundZone"> <script language="javascript" type="text/javascript"> function startflag() { document.getElementById("pn").innerHTML = "button click"; } </script> ==获取用户输入一项信息== ===html部分=== <input type="button" name="button" value="输入姓名" onclick="check()" class="button"> <a id="iname"></a> ===script 代码=== <script lang="javascript"> function check() { var name = prompt("请输入你的名字:"); document.getElementById("iname").innerHTML = name; } </script> ==调用c#函数== document.getElementById("Button1").click(); ==访问c#文本框内容== var tel = prompt("请输入你的电话号码:"); document.getElementById("TextBox3").value = tel; c#label的Text不能访问,可以访问C#button的事件更改label的内容
返回
Java script
。