javascript常用知识点积累

1.弹出确定提示框后提交表单

<html>
<head></head>
<body>		
<form name="formdata" method="post" action="http://www.baidu.com"> 
   <p> 
     <input type="text" name="textfield" value="确认后提交"> 
   </p> 
   <p> 
     <input type="button" name="Submit" value="提交" onclick="msg();"> 
   </p> 
</form> 
</body>
</html>
<SCRIPT LANGUAGE="JavaScript"> 
function msg(){ 
if (confirm("你确认要提交嘛!")) 
document.formdata.submit() 
} 
</SCRIPT>

2.查看某网址的源代码

<html>
<head></head>
<body>		
<SCRIPT> 
function view() 
{ 
var ress=document.forms[0].view_source.value 
window.location="view-source:"+ress; 
} 
</SCRIPT> 
输入要查看源代码的URL地址: 
<FORM><input type="text" name="view_source" size=40 value="http://"></FORM> 
<FORM><br> 
<INPUT type="button" value="查看源代码" onClick = view()> 
</FORM> 
</body>
</html>




你可能感兴趣的:(javascript常用知识点积累)