查看: 1202|回复: 8
收起左侧

[已解决] 关于网页的一些问题

 关闭 [复制链接]
llxm920
发表于 2010-2-16 15:31:36 | 显示全部楼层 |阅读模式
本帖最后由 llxm920 于 2010-2-16 20:52 编辑

用HTM的话能不能实现判断输入框里有没输入内容,按下确定建后,有内容跳往一个页面,没有内容跳往另一个页面。
缩头者
头像被屏蔽
发表于 2010-2-16 15:35:34 | 显示全部楼层
用JS函数判断
llxm920
 楼主| 发表于 2010-2-16 15:37:39 | 显示全部楼层
回复 2# 缩头者

具体要怎么实现?
缩头者
头像被屏蔽
发表于 2010-2-16 16:28:28 | 显示全部楼层
回复 3# llxm920


    等别人吧,我只能看懂代码
用js判断表单为空就会,加跳转不懂

评分

参与人数 1人气 +1 收起 理由
llxm920 + 1 也要感谢你`:)

查看全部评分

llxm920
 楼主| 发表于 2010-2-16 18:37:29 | 显示全部楼层
再在javascript部分加上下述函数: 得到这个答案,但是不会用。用了几个方法没效果- -

function submitForm(){
  if(document.getElementById("q").value==""){
    document.getElementById("form1").action="2.html";
  }

  document.getElementById("form1").submit;
}

以下是我要修改的:
<html>
<xml><body>
</xml>
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<META name="Keywords" content="hihi">
<title>标题</title>
<style>
<!--
td{ }
td{color:#000}
.j{width:34em}
div .j{line-height:120%}
-->
</style>
<meta http-equiv="Page-Exit" content="revealTrans(Duration=1.0,Transition=12)">
</head>
<body text="#FFFFFF" bgcolor="#000000">
<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
var clocktext;
var pagetitle = document.title;
function scroll() {
today = new Date();
sec = today.getSeconds();
hr = today.getHours();
min = today.getMinutes();
if (hr <= 9) hr = "0" + hr;
if (min <= 9) min = "0" + min;
if (sec <= 9) sec = "0" + sec;
var clocktext = " 现在时间是: " + hr + ":" + min + ":" + sec;
clocktimer = setTimeout("scroll()", 1000);
document.title = pagetitle + clocktext;
}
if (document.all) scroll();
// End -->
function submitForm(){
  if(document.getElementById("q").value==""){
    document.getElementById("form1").action="2.html";
  }
  document.getElementById("form1").submit;
}
</script>

<form id="form1" method="get" action="1.htm" target="_self">
<p align="center" style="margin-top: 0; margin-bottom: 0">提示。</p>
<p align="center" style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p align="center" style="margin-top: 0; margin-bottom: 0">
<input type=text name="q" id="q" size="27"> <br>
<br>
<input type="button" name="btnG" value=" 确定 " style="background-color: #FFFFFF; font-weight:bold">
<input type=hidden name=ie value=GB2312>
<input type=hidden name=oe value=GB2312>
<input type=hidden name=hl value=zh-CN>
<input type=hidden name=domains value="na">
<input type=hidden name=sitesearch value="na">
</p>
</form>
<p align="center" style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p align="center" style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p align="center" style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p align="center" style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p align="center" style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p align="center" style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p align="center" style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p align="center" style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p align="center" style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p align="center" style="margin-top: 0; margin-bottom: 0">&nbsp;</p>
<p align="center" style="margin-top: 0; margin-bottom: 0">
&nbsp;</p>
</body>

</html>
<style>
维伊
发表于 2010-2-16 20:08:39 | 显示全部楼层
  1. <html>
  2. <head>
  3. <title>标题</title>
  4. <script language="javascript">
  5. function checkform() {
  6.         if(document.getElementById("q").value=="") {
  7.                 document.getElementById("form1").action="2.htm";
  8.                 }
  9.         document.getElementById("form1").submit();
  10. }
  11. </script>
  12. </head>

  13. <body>
  14. <form id="form1" method="get" action="1.htm">
  15.   <input type="text" name="q" id="q">
  16.    <input type="button" name="btn" value="提交" onClick="checkform()">
  17. </form>
  18. </body>
  19. </html>
复制代码

评分

参与人数 3经验 +5 人气 +2 收起 理由
淘金者 + 5 感谢解答: )
缩头者 + 1 感谢解答
llxm920 + 1 感谢解答: )

查看全部评分

llxm920
 楼主| 发表于 2010-2-16 20:51:48 | 显示全部楼层
回复 6# skyzjg

太感谢了,原来是我书写不规范
维伊
发表于 2010-2-16 21:05:05 | 显示全部楼层
你的网页基本结构,是用Frontpage搞出来的?
换dreamweaver,或直接记事本吧。。
llxm920
 楼主| 发表于 2010-2-16 21:07:47 | 显示全部楼层
回复 8# skyzjg

我现在就直接记事本编辑了

评分

参与人数 1人气 +1 收起 理由
缩头者 + 1 恭喜了

查看全部评分

您需要登录后才可以回帖 登录 | 快速注册

本版积分规则

手机版|杀毒软件|软件论坛| 卡饭论坛

Copyright © KaFan  KaFan.cn All Rights Reserved.

Powered by Discuz! X3.4( 沪ICP备2020031077号-2 ) GMT+8, 2025-7-14 14:08 , Processed in 0.128649 second(s), 19 queries .

卡饭网所发布的一切软件、样本、工具、文章等仅限用于学习和研究,不得将上述内容用于商业或者其他非法用途,否则产生的一切后果自负,本站信息来自网络,版权争议问题与本站无关,您必须在下载后的24小时之内从您的电脑中彻底删除上述信息,如有问题请通过邮件与我们联系。

快速回复 客服 返回顶部 返回列表