Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/382.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript HTML文本区域显示br_Javascript_Html - Fatal编程技术网

Javascript HTML文本区域显示br

Javascript HTML文本区域显示br,javascript,html,Javascript,Html,我有一个HTML文本区。在TexTaReA中,空白行是Br.< /P> 我试图获得一些文本的价值。并使用get发布。之后我收到了与php。我把一些文本的值改成了变量 像这样: a<br />b c ab c 代码(使用javascript发布): 函数nl2br(str,is_xhtml){ var breakTag=(is|xhtml | typeof is|xhtml==='undefined')?“”:“”; 返回(str+'')。替换(/([^>\r\n]?)(\r\n

我有一个HTML文本区。在TexTaReA中,空白行是Br.< /P> 我试图获得一些文本的价值。并使用get发布。之后我收到了与php。我把一些文本的值改成了变量

像这样:

a<br />b c
a
b c
代码(使用javascript发布):


函数nl2br(str,is_xhtml){
var breakTag=(is|xhtml | typeof is|xhtml==='undefined')?“
”:“
”; 返回(str+'')。替换(/([^>\r\n]?)(\r\n |\n\r |\r |\n)/g,'$1'+breakTag+'$2'); } 功能菜单(secilen){ var deger=secilen.options[secilen.selectedIndex].value; var urunadi=document.getElementById(“okulueua”).value; var urunfiyati=document.getElementById(“okulueuf”).value; var kargofiyati=document.getElementById(“okuluekf”).value; var aciklama=nl2br(document.getElementById(“okulueat”).value); 警报(阿奇克拉玛); window.location.href=“okulue.php”菜单=“+deger+”&urunadi=“+urunadi+”&urunfiyati=“+urunfiyati+”&kargofiyati=“+kargofiyati+”&aciklama=“+aciklama; }
代码(使用php获取):


函数br2nl($content){
$content=str_ireplace(“
,”\n“,$content); 返回$content; } 函数br2nl1($input){ 返回preg_replace('//i',“\n',$input); } document.getElementById(“menusecme1”).style.width=“315px”; document.getElementById(“okulueua”).value=“”; document.getElementById(“okulueuf”).value=“”; document.getElementById(“okuluekf”).value=“”; document.getElementById(“okulueat”).value=“”; $('select[name^=“ms1”]option[value=”“])。attr(“selected”、“selected”);
代码(HTML):


我怎样才能解决这个问题

我需要你的帮助

注意:我的英语不好。对不起我希望你能理解。

试试这个:

 <textarea>a&#13;&#10;b c</textarea>
a
b c

欢迎来到SO。请访问,了解如何提问。提示:发布工作和代码-这里的信息太少。你使用的是像tiniyMCE这样的HTML文本区域编辑器吗?@mplungjan否。我不使用。我将更改问题。谢谢。如果您有PHP和
,那么您需要取消对variable@mplungjan但是我用Javascript改变了我们怎么知道呢。显示一些代码!甚至没有带有JavaScript的标记。请创建一个具有相同结果的。结果:a b c
<?php

    if (isset($_GET['menu'])) {

        $secilendeger = filter_input(INPUT_GET, "menu");

        $urunadiget = filter_input(INPUT_GET, "urunadi");

        $urunfiyatiget = filter_input(INPUT_GET, "urunfiyati");

        $kargofiyatiget = filter_input(INPUT_GET, "kargofiyati");

        $aciklamaget = filter_input(INPUT_GET, "aciklama");

        echo($aciklamaget);

        ?>

        <script type="text/javascript">

            function br2nl($content){

                $content = str_ireplace("<br /> ", "\n", $content);
                return $content;

            }

            function br2nl1($input){
    return preg_replace('/<br(\s+)?\/?>/i', "\n", $input);
}

            document.getElementById("menusecme1").style.width = "315px";

            document.getElementById("okulueua").value = "<?php echo($urunadiget); ?>";

            document.getElementById("okulueuf").value = "<?php echo($urunfiyatiget); ?>";

            document.getElementById("okuluekf").value = "<?php echo($kargofiyatiget); ?>";

            document.getElementById("okulueat").value = "<?php echo($aciklamaget); ?>";

            $('select[name^="ms1"] option[value="<?php echo($secilendeger); ?>"]').attr("selected","selected");

        </script>
<input type="text" class="okulueuat" name="okulueua" id="okulueua">
<input type="text" class="okulueua2t" name="okulueua2" value="1000" readonly="yes">
<input type="text" class="okulueuft" name="okulueuf" id="okulueuf">
<input type="text" class="okuluekft" name="okuluekf" value="5" id="okuluekf">
<input type="submit" class="tamamb2" value="Tamam" name="submit">
<input type="button" class="iptalb2" value="İptal" onclick="location='okulul.php'">
<input type="file" name="okuluef[]" class="resimeklec" multiple="multiple">

<textarea id="okulueat" name="okuluea"></textarea>
 <textarea>a&#13;&#10;b c</textarea>