>  기사  >  백엔드 개발  >  복제 코드는 js를 복제할 수 없습니다. 복제 후 html의 내용을 바꾸는 방법은 무엇입니까?

복제 코드는 js를 복제할 수 없습니다. 복제 후 html의 내용을 바꾸는 방법은 무엇입니까?

WBOY
WBOY원래의
2016-10-10 11:56:201045검색

<code>     <td id="uses">
    <span id="userinfo">
    <table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:3px;">
       <tr> 
        <td width="90" class="bline" height='24'> 项目:</td>
        <td class="bline"><input type='text' name='szxm' id='szxm' style='width:250px'  class='intxt' value='' />
</td>
       </tr>
    </table>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:3px;">
       <tr> 
        <td width="90" class="bline" height='24'> 时间:</td>
        <td class="bline"><input name="oper_time" value="2016-09-30 18:51:10" type="text" id="oper_time" style="width:250px" class="intxt"  />   <script language="javascript" type="text/javascript">
                    Calendar.setup({
                        inputField     :    "oper_time",
                        ifFormat       :    "%Y-%m-%d %H:%M",
                        showsTime      :    true,
                        timeFormat     :    "24"
                    });
                 </script></td>
       </tr>
    </table>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:3px;">
       <tr> 
        <td width="90" class="bline" height='24'> 手术医生:</td>
        <td class="bline"><input type='text' name='oper_doc' id='oper_doc' style='width:250px'  class='intxt' value='' />
</td>
       </tr>
    </table>

    <table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:3px;">
       <tr> 
        <td width="90" class="bline" height='24'> 照片:</td>
        <td class="bline"><textarea name="oper_beforephot" rows="8" cols="60"></textarea>
<script type="text/javascript">//<![CDATA[
window.CKEDITOR_BASEPATH='/include/ckeditor/';
//]]></script>
<script type="text/javascript" src="/include/ckeditor/ckeditor.js?t=B8DJ5M3"></script>
<script type="text/javascript">//<![CDATA[
CKEDITOR.replace('oper_beforephot', {"extraPlugins":"dedepage,multipic,addon","toolbar":[["Source","-","Templates"],["Cut","Copy","Paste","PasteText","PasteFromWord","-","Print"],["Undo","Redo","-","Find","Replace","-","SelectAll","RemoveFormat"],["ShowBlocks"],["Image","Flash","Addon"],["Maximize"],"\/",["Bold","Italic","Underline","Strike","-"],["NumberedList","BulletedList","-","Outdent","Indent","Blockquote"],["JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock"],["Table","HorizontalRule","Smiley","SpecialChar"],["Link","Unlink","Anchor"],"\/",["Styles","Format","Font","FontSize"],["TextColor","BGColor","MyPage","MultiPic"]],"height":350,"skin":"kama"});
//]]></script>
</td>
       </tr>
    </table>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:3px;">
       <tr> 
        <td width="90" class="bline" height='24'> 照片:</td>
        <td class="bline"><textarea name="rec_photo" rows="8" cols="60"></textarea>
<script type="text/javascript">//<![CDATA[
CKEDITOR.replace('rec_photo', {"extraPlugins":"dedepage,multipic,addon","toolbar":[["Source","-","Templates"],["Cut","Copy","Paste","PasteText","PasteFromWord","-","Print"],["Undo","Redo","-","Find","Replace","-","SelectAll","RemoveFormat"],["ShowBlocks"],["Image","Flash","Addon"],["Maximize"],"\/",["Bold","Italic","Underline","Strike","-"],["NumberedList","BulletedList","-","Outdent","Indent","Blockquote"],["JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock"],["Table","HorizontalRule","Smiley","SpecialChar"],["Link","Unlink","Anchor"],"\/",["Styles","Format","Font","FontSize"],["TextColor","BGColor","MyPage","MultiPic"]],"height":350,"skin":"kama"});
//]]></script>
</td>
       </tr>
    </table>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:3px;">
       <tr> 
        <td width="90" class="bline" height='24'> 照片:</td>
        <td class="bline"><textarea name="oper_afterphot" rows="8" cols="60"></textarea>
<script type="text/javascript">//<![CDATA[
CKEDITOR.replace('oper_afterphot', {"extraPlugins":"dedepage,multipic,addon","toolbar":[["Source","-","Templates"],["Cut","Copy","Paste","PasteText","PasteFromWord","-","Print"],["Undo","Redo","-","Find","Replace","-","SelectAll","RemoveFormat"],["ShowBlocks"],["Image","Flash","Addon"],["Maximize"],"\/",["Bold","Italic","Underline","Strike","-"],["NumberedList","BulletedList","-","Outdent","Indent","Blockquote"],["JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock"],["Table","HorizontalRule","Smiley","SpecialChar"],["Link","Unlink","Anchor"],"\/",["Styles","Format","Font","FontSize"],["TextColor","BGColor","MyPage","MultiPic"]],"height":350,"skin":"kama"});
//]]></script>
</td>
       </tr>
    </table>
    </span>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:3px;">
        <tr><input id="addxm" type="button" value="添加项目" /></tr>
    </table>
</td>

//js
$("#addxm").click( function(){
$('#userinfo').after($("#userinfo").clone(true).addClass("newinfo"));})
</code>

코드 복제 시 js가 복제되지 않는 이유와 복제된 코드 문자열을 바꾸는 방법은 무엇인가요?

답글 내용:

<code>     <td id="uses">
    <span id="userinfo">
    <table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:3px;">
       <tr> 
        <td width="90" class="bline" height='24'> 项目:</td>
        <td class="bline"><input type='text' name='szxm' id='szxm' style='width:250px'  class='intxt' value='' />
</td>
       </tr>
    </table>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:3px;">
       <tr> 
        <td width="90" class="bline" height='24'> 时间:</td>
        <td class="bline"><input name="oper_time" value="2016-09-30 18:51:10" type="text" id="oper_time" style="width:250px" class="intxt"  />   <script language="javascript" type="text/javascript">
                    Calendar.setup({
                        inputField     :    "oper_time",
                        ifFormat       :    "%Y-%m-%d %H:%M",
                        showsTime      :    true,
                        timeFormat     :    "24"
                    });
                 </script></td>
       </tr>
    </table>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:3px;">
       <tr> 
        <td width="90" class="bline" height='24'> 手术医生:</td>
        <td class="bline"><input type='text' name='oper_doc' id='oper_doc' style='width:250px'  class='intxt' value='' />
</td>
       </tr>
    </table>

    <table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:3px;">
       <tr> 
        <td width="90" class="bline" height='24'> 照片:</td>
        <td class="bline"><textarea name="oper_beforephot" rows="8" cols="60"></textarea>
<script type="text/javascript">//<![CDATA[
window.CKEDITOR_BASEPATH='/include/ckeditor/';
//]]></script>
<script type="text/javascript" src="/include/ckeditor/ckeditor.js?t=B8DJ5M3"></script>
<script type="text/javascript">//<![CDATA[
CKEDITOR.replace('oper_beforephot', {"extraPlugins":"dedepage,multipic,addon","toolbar":[["Source","-","Templates"],["Cut","Copy","Paste","PasteText","PasteFromWord","-","Print"],["Undo","Redo","-","Find","Replace","-","SelectAll","RemoveFormat"],["ShowBlocks"],["Image","Flash","Addon"],["Maximize"],"\/",["Bold","Italic","Underline","Strike","-"],["NumberedList","BulletedList","-","Outdent","Indent","Blockquote"],["JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock"],["Table","HorizontalRule","Smiley","SpecialChar"],["Link","Unlink","Anchor"],"\/",["Styles","Format","Font","FontSize"],["TextColor","BGColor","MyPage","MultiPic"]],"height":350,"skin":"kama"});
//]]></script>
</td>
       </tr>
    </table>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:3px;">
       <tr> 
        <td width="90" class="bline" height='24'> 照片:</td>
        <td class="bline"><textarea name="rec_photo" rows="8" cols="60"></textarea>
<script type="text/javascript">//<![CDATA[
CKEDITOR.replace('rec_photo', {"extraPlugins":"dedepage,multipic,addon","toolbar":[["Source","-","Templates"],["Cut","Copy","Paste","PasteText","PasteFromWord","-","Print"],["Undo","Redo","-","Find","Replace","-","SelectAll","RemoveFormat"],["ShowBlocks"],["Image","Flash","Addon"],["Maximize"],"\/",["Bold","Italic","Underline","Strike","-"],["NumberedList","BulletedList","-","Outdent","Indent","Blockquote"],["JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock"],["Table","HorizontalRule","Smiley","SpecialChar"],["Link","Unlink","Anchor"],"\/",["Styles","Format","Font","FontSize"],["TextColor","BGColor","MyPage","MultiPic"]],"height":350,"skin":"kama"});
//]]></script>
</td>
       </tr>
    </table>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:3px;">
       <tr> 
        <td width="90" class="bline" height='24'> 照片:</td>
        <td class="bline"><textarea name="oper_afterphot" rows="8" cols="60"></textarea>
<script type="text/javascript">//<![CDATA[
CKEDITOR.replace('oper_afterphot', {"extraPlugins":"dedepage,multipic,addon","toolbar":[["Source","-","Templates"],["Cut","Copy","Paste","PasteText","PasteFromWord","-","Print"],["Undo","Redo","-","Find","Replace","-","SelectAll","RemoveFormat"],["ShowBlocks"],["Image","Flash","Addon"],["Maximize"],"\/",["Bold","Italic","Underline","Strike","-"],["NumberedList","BulletedList","-","Outdent","Indent","Blockquote"],["JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock"],["Table","HorizontalRule","Smiley","SpecialChar"],["Link","Unlink","Anchor"],"\/",["Styles","Format","Font","FontSize"],["TextColor","BGColor","MyPage","MultiPic"]],"height":350,"skin":"kama"});
//]]></script>
</td>
       </tr>
    </table>
    </span>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-bottom:3px;">
        <tr><input id="addxm" type="button" value="添加项目" /></tr>
    </table>
</td>

//js
$("#addxm").click( function(){
$('#userinfo').after($("#userinfo").clone(true).addClass("newinfo"));})
</code>

코드 복제 시 js가 복제되지 않는 이유와 복제된 코드 문자열을 바꾸는 방법은 무엇인가요?

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.