正确输出<textarea></textarea>编辑的内容格式

<script type="text/javascript">
    $(function () {
        $(".contentxin").each(function() {
            var temp =  $(this).text().replace(/\n|\r\n/g,'<br/>');
            temp = temp.replace(/\s/g,"  ");
            $(this).html(temp);
        });
    })
</script>

<?php if(!$solution_name){ if($OJ_ACE_EDITOR){ if (isset($OJ_TEST_RUN)&&$OJ_TEST_RUN) $height=“400px”; else $height=“500px”; ?> <pre style=“width:90%;height:<?php echo $height?>” cols=180 rows=16 id=“source”><?php echo htmlentities($view_src,ENT_QUOTES,“UTF-8”)?></pre> <input type=hidden id=“hide_source” name=“source” value=“”/> <?php }else{ ?> <textarea style="width:80%;height:600" cols=180 rows=30 id="source" name="source"><?php echo htmlentities($view_src,ENT_QUOTES,"UTF-8")?></textarea> <?php } }else{ echo "<br><h2>指定上传文件:$solution_name</h2>"; } ?> <div class="row"> <div class="column" style="display: flex;"> <?php if ( isset($OJ_TEST_RUN) && $OJ_TEST_RUN && $spj<=1 && !$solution_name ){?> <div style=" margin-left: 60px; width: 40%; padding: 14px; flex-direction: column;"> <div style=" display: flex; border-radius: 8px; background-color: rgb(255,255,255,0.4);" id="language_span"><?php echo $MSG_Input?></div> <textarea style="width:100%" cols=40 rows=5 id="input_text" name="input_text" ><?php echo $view_sample_input?></textarea> </div> <div style=" width: 40%; flex-direction: column; "> <div style=" display: flex; border-radius: 8px; background-color: rgb(255,255,255,0.4);justify-content: space-between;" id="language_span"><?php echo $MSG_Output ?> <span class=“btn” id=result><?php echo $MSG_STATUS?></span> </div> <textarea style=" width:100%;background-color: white; " cols=10 rows=5 id="out" name="out" disabled="true" placeholder='<?php echo htmlentities($view_sample_output,ENT_QUOTES,'UTF-8')?>' ></textarea> </div> <?php } ?> <?php if (isset($OJ_TEST_RUN)&&$OJ_TEST_RUN && $spj<=1 && !$solution_name ){?> <!–运行按钮–> <input style=" margin-top: 30px; margin-left: 0 auto; width: 7%;background-color: #22ba46a3;border-color: #00fff470;height: 130px; " id=“TestRun” class=“btn btn-info” type=button value=“<?php echo $MSG_TR?>” onclick=do_test_run();> <?php }?> </div> </div> </div> <input type=“hidden” value=“0” id=“problem_id” name=“problem_id”/> </form> <?php if (isset($OJ_BLOCKLY)&&$OJ_BLOCKLY){?> <input id=“blockly_loader” type=button class=“btn” onclick=“openBlockly()” value=“<?php echo $MSG_BLOCKLY_OPEN?>” style=“color:white;background-color:rgb(169,91,128)”> <input id=“transrun” type=button class=“btn” onclick=“loadFromBlockly() " value=”<?php echo $MSG_BLOCKLY_TEST?>" style=“display:none;color:white;background-color:rgb(90,164,139)”> <div id=“blockly” class=“center”>Blockly</div> <?php }?> 不改变原功能的基础上、优化代码、简化代码、美化界面、提高效率 、直接给出优化过的完整代码
最新发布
04-03
<?php if(!$solution_name){ if($OJ_ACE_EDITOR){ if (isset($OJ_TEST_RUN)&&$OJ_TEST_RUN) $height="400px"; else $height="500px"; ?> <pre style="width:90%;height:<?php echo $height?>" cols=180 rows=16 id="source"><?php echo htmlentities($view_src,ENT_QUOTES,"UTF-8")?></pre> <input type=hidden id="hide_source" name="source" value=""/> <?php }else{ ?> <textarea style="width:80%;height:600" cols=180 rows=30 id="source" name="source"><?php echo htmlentities($view_src,ENT_QUOTES,"UTF-8")?></textarea> <?php } }else{ echo "<br><h2>指定上传文件:$solution_name</h2>"; } ?> <div class="row"> <div class="column" style="display: flex;"> <?php if ( isset($OJ_TEST_RUN) && $OJ_TEST_RUN && $spj<=1 && !$solution_name ){?> <div style=" margin-left: 60px; width: 40%; padding: 14px; flex-direction: column;"> <div style=" display: flex; border-radius: 8px; background-color: rgb(255,255,255,0.4);" id="language_span"><?php echo $MSG_Input?></div> <textarea style="width:100%" cols=40 rows=5 id="input_text" name="input_text" ><?php echo $view_sample_input?></textarea> </div> <div style=" width: 40%; flex-direction: column; "> <div style=" display: flex; border-radius: 8px; background-color: rgb(255,255,255,0.4);justify-content: space-between;" id="language_span"><?php echo $MSG_Output ?> <span class="btn" id=result><?php echo $MSG_STATUS?></span> </div> <textarea style=" width:100%;background-color: white; " cols=10 rows=5 id="out" name="out" disabled="true" placeholder='<?php echo htmlentities($view_sample_output,ENT_QUOTES,'UTF-8')?>' ></textarea> </div> <?php } ?> <?php if (isset($OJ_TEST_RUN)&&$OJ_TEST_RUN && $spj<=1 && !$solution_name ){?> <!--运行按钮--> <input style=" margin-top: 30px; margin-left: 0 auto; width: 7%;background-color: #22ba46a3;border-color: #00fff470;height: 130px; " id="TestRun" class="btn btn-info" type=button value="<?php echo $MSG_TR?>" onclick=do_test_run();> <?php }?> </div> </div> </div> <input type="hidden" value="0" id="problem_id" name="problem_id"/> </form> <?php if (isset($OJ_BLOCKLY)&&$OJ_BLOCKLY){?> <input id="blockly_loader" type=button class="btn" onclick="openBlockly()" value="<?php echo $MSG_BLOCKLY_OPEN?>" style="color:white;background-color:rgb(169,91,128)"> <input id="transrun" type=button class="btn" onclick="loadFromBlockly() " value="<?php echo $MSG_BLOCKLY_TEST?>" style="display:none;color:white;background-color:rgb(90,164,139)"> <div id="blockly" class="center">Blockly</div> <?php }?> 不改变原功能的基础上、优化代码、简化代码、美化界面、提高效率
04-03
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值