【问题标题】:Input Box is not appearing?输入框没有出现?
【发布时间】:2018-05-05 15:06:33
【问题描述】:

我编码adding comments function to RSS articles

一波三折,在php编码中显示和输入cmets。但是,输入框不会出现。

这里是php代码:

$url = "./comments/" . $q.".txt";
//댓글 파일에서 컨텐츠 문자열 가져오기
$txtcomment = file_get_contents($url,true);    
//댓글 나열
echo "<ol>";

if ($q !== "" ) {            
                 $comm = $txtcomment;
                 $arr = [];
                 $arr = explode("--",$comm);
             for ($i=4;$i<count($arr);$i++) {
            echo "<li>".$arr[$i]."</li>";            
       } 
    } else {
    echo "해당기사가 없습니다.";
  }

echo "</ol>";

//중첩검색&결과내 검색 폼 만들기
echo "<br><form class=\"category B\" >
Comment: <input type=\"text\" name=\"comment1\" id=\"comment1\" onkeyup=\"inputComment()\" > 
</form>";

为什么? 感谢您的关心。

【问题讨论】:

  • 使用浏览器开发工具查看它是否只是隐藏,因为你没有标准的有序列表,所以它可能是 CSS。您也可以在 PHP 中使用单引号:/
  • 页面的源代码(脚本的 HTML 输出)是什么样的?
  • @LawrenceCherone 是的,谢谢你的单引号评论。之后,我会使用它。但是,输入框不是静止的。 CSS没有关于输入标签的隐藏功能。
  • @stickybi stackoverflow.com/questions/50181624/… 是我之前完成的编码。因为输入框不是,我无法编写js inputComment()。
  • @stickybit 抱歉,我编辑了我的帖子。网址错误。

标签: php html dom


【解决方案1】:

由于我使用 RSS,我认为 php 没有正确传递输入标签的属性。我开始改变旧的编码。

换句话说,我决定 Show Comments 和输入 cmets 从一开始就不同。

getrss.php code 首先如下。

echo " <option  id=".$i." onclick=\"showComment".$i."(this.value)\" value=".$item_link4."> Show Comments </option>";

但是,我添加了输入代码,就像

  echo " <option  id=".$i." onclick=\"showComment".$i."(this.value)\" value=".$item_link4."> Show Comments </option>";
  echo "댓글: <input type='text' name='inputComment' size='200' id='input".$i."' onclick='inputComment".$i."(this.value)' >
              <input type='text' name='txtfile' id='txt".$i."' value=".$item_link4." hidden>
              <div id='comment".$i."'><b>information will be listed here.</b></div>";

并且,我将输入框制作为下图。

最后,我试图以迂回的方式解决问题。 但是,我还是想知道为什么ajax的ajax不行!!

在我输入我的评论后,我马上就看到了。

进一步的编码制作了下面的图片。 非常感谢您的分享。

【讨论】:

  • 可能是他们的ajax代码错误,在浏览器中使用开发者控制台查看错误。
  • @AmmarAli 是的,可能有问题。但是,现在我的知识水平低于这个水平。总有一天我会得到它。
  • @AmmarAli 好消息来源!但是,我只使用 javascript 而不是 jQuery。最近js和jquery同时在一个html页面做?没有冲突?
猜你喜欢
  • 2019-04-29
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-06-16
相关资源
最近更新 更多