如何在Wordpress Post中使用该代码?

时间:2013-01-16 16:27:18

标签: wordpress

我想在Wordpress Post中使用该代码。

当我在没有Wordpress的情况下使用该代码时,它可以工作。我的意思是我创建了一个php文件并将此代码粘贴在其中。它有效。但它在Wordpress帖子中不起作用。

我该怎么办?

请帮帮我。提前谢谢。

<html>
<head>
<title>test</title>
<style type="text/css" media="screen">
textarea { resize: none; }
.hide{ display: none; }
#popupoverlay { background-color: #000000; bottom: 0px; display: none; left: 0px; opacity: .75; position: fixed; right: 0px; top: 0px; }
#popupwindow { background-color: #FAFAD2; border: solid 2px #cccccc; display: none; height: 150px; left: 50%; margin: -75px 0 0 -35px; position: absolute; left: 350px; top: 80px; width: 800px; height: 630px }
#popupwindow a { background-color: #ff3333; display: block; font-size: 9px; height: 20px; left: 50%; margin: -309px 0 0 370px; position: absolute; text-align: center; text-decoration: none; top: 50%; width: 25px; }
#popupwindow h1 { background-color: #cccccc; display: block; margin: 0; padding: 3px 5px; text-align: center; }
#popupwindow p { font-size: 9pt; margin: 0px; padding: 5px; }
body{font: 9pt Verdana;list-style:none;margin:0;padding:-10}
td{font: 9pt Verdana;}
th{font: 9pt Verdana; text-align: left; font-weight: bold;}
</style>
<SCRIPT>
function checkEmail(myForm) {
if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(myForm.email.value)){
return (true)
}
alert("Please check your email.")
return (false)
}
//  End -->
</script>
<script>
function SayiKontrol(e) {
    olay = document.all ? window.event : e;
    tus = document.all ? olay.keyCode : olay.which;
    if(tus<48||tus>57) {
        if(document.all) { olay.returnValue = false; } else { olay.preventDefault(); }
    }
}

function HarfKontrol(e) {
    olay = document.all ? window.event : e;
    tus = document.all ? olay.keyCode : olay.which;
    if(tus>=48&&tus<=57) {
        if(document.all) { olay.returnValue = false; } else { olay.preventDefault(); }
    }
}
</script>
    <script type="text/javascript">
    function OpenPopup() {
        document.getElementById('PopupOverlay').style.display = 'block';
        document.getElementById('PopupWindow').style.display = 'block';
    }
    function ClosePopup() {
        document.getElementById('PopupOverlay').style.display = 'none';
        document.getElementById('PopupWindow').style.display = 'none';
    }
    </script>
    <script language="JavaScript" type="text/javascript">
/*<![CDATA[*/
function HostingSpec(rad){
 var rads=document.getElementsByName(rad.name);
 var all=['first_giz','first_giz_1','second_giz']
 var ary=[
  ['first_giz','first_giz_1'],
  ['second_giz']
 ]
 for (var z0=0;z0<all.length;z0++){
  document.getElementById(all[z0]).style.display='none';
 }
 for (var z1a,z1=0;z1<rads.length;z1++){
  if (rads[z1].checked&&ary[z1]){
   for (z1a=0;z1a<ary[z1].length;z1a++){
    document.getElementById(ary[z1][z1a]).style.display='block';
   }
   return;
  }
 }

}
/*]]>*/
</script>
</head>
<body>
<form name="myform" action="submit.php" method="POST" onSubmit="return checkEmail(this)">
       <a href="javascript: void(0)" onClick="OpenPopup();"><img border="0" src="submit.jpg"></a>
    </p>

    <div id="PopupOverlay"></div>
    <div id="PopupWindow">
<h1>Test</h1>
<table border="0" width="100%" cellspacing="1">
<tr>
<th width="333">Name</th>
<th width="249">Surname</th>
<th width="258">No<th width="182">Email</th>
</tr>
            <tr><td width="333"><input type="text" name="name" size="45"></td>
                <td width="249">
                <!--webbot bot="Validation" s-display-name="name" s-data-type="Integer" s-number-separators="x" i-maximum-length="12" --><input type="text" name="name2" size="10" maxlength="11"></td>
                <td width="258"> 
                &nbsp;<input type="text" name="name3" size="10" maxlength="11"></td>
                <td width="182"><input type="text" name="email" size="20"></td>
        </tr>
            <tr>
                <td width="333">&nbsp;</td>
                <td width="249">&nbsp;</td>
                <td colspan="2">&nbsp;</td>
            </tr>
<tr><th width="333">Address</th>
    <th width="249">area 1</th>
<th colspan="2">area 2</th>
            </tr>
            <tr>
                <td width="333">
        <textarea rows="4" name="address" cols="39"></textarea></td>
                <td width="249">

        <input type="text" name="area1" size="20"><br>
        <b>area 3</b><br>
        <input type="text" name="area2" size="20"></td>
                <td colspan="2">

        <input type="text" name="area3" size="20"><br>
        <b>area 4</b><br>
        <input type="text" name="area4" size="20" maxlength="4"></td>
            </tr>
            <tr>
<th width="333">&nbsp;</th>
<th width="249">area 5</th>
<th colspan="2">area 6</th>
            </tr>
            <tr>
                <td width="333"> 

        &nbsp;</td>
                <td width="249"> 

        <input type="text" name="area5" size="20">
        <font color="#666666">(description)<br>
&nbsp;</font></td>
                <td colspan="2">

<input type="text" name="area6" size="20"><font color="#666666">(description)</font></td>
            </tr>
            <tr>
<th width="333">additional information</th>
<th width="249">&nbsp;</th>
<td colspan="2">&nbsp;</td>
            </tr>
            <tr>
                <td colspan="4">

                  <textarea name="message" cols="93" rows="5"></textarea></td>
            </tr>
            <tr>
                <td width="333" align="center">
                <p align="left">div 1 
<INPUT type="radio" name="hosting_package" id="hosting_package_1" value="1" class="validate[required] radio" onClick="HostingSpec(this);" /></td>
                <td width="249" align="center">
                <p align="left">div 2
              <input type="radio" name="hosting_package" id="hosting_package_2" value="2" class="validate[required] radio" onClick="HostingSpec(this);" />
                <br>
                </td>
<td colspan="2"><br>
</td>
            </tr>
            <tr id="first_giz" style="display:none;">
<th width="333">Company</th>
<th width="249">
&nbsp;</th>
                <td colspan="2">&nbsp;</td>
            </tr>
            <tr id="first_giz_1" style="display:none;">
<td width="333"><select size="1" name="company">
        <option>test 1</option>
        <option>test 2</option>
        </select></td>
<td width="249"><br>
&nbsp;</td>
                <td colspan="2">&nbsp;</td>
            </tr>
            <tr id="second_giz" style="display:none;">
                <td width="333">
<b>company 2<br>
<br>
</b>
<select size="1" name="company2">
<option>test 1</option>
<option>test 2</option>
<option>test 3</option>
        </select><br>
<br>
<br>
<br>
<br>
<br>
&nbsp;</td>
                <td width="249">
<b>company 3<br>
</b>
<select size="1" name="company3">
        <option>test 1</option>
        <option>test 2</option>
        <option>test 3</option>
        </select><b><br>
<br>
area 7<br>
        </b><input type="text" name="test1" size="10"><b><br>
    area 8<br>
        </b>


        <input type="text" name="test2" size="10"><br>
&nbsp;</td>
                <td colspan="2">
&nbsp;</td>
            </tr></table>
<table border="0" width="1151" cellspacing="0" cellpadding="0">
    <tr>
        <td width="1151">

    <tr>
        <td width="1151">

<blockquote>
    <blockquote>
        <blockquote>
            <blockquote>
                <blockquote>
                    <blockquote>
                        <blockquote>
                            <blockquote>
                                <blockquote>
                                    <input type="submit" name="button" value="Submit" style="height: 50px; width: 200px; font-size:14pt; font-weight:bold; float:right"></blockquote>
                            </blockquote>
                        </blockquote>
                    </blockquote>
                </blockquote>
            </blockquote>
        </blockquote>
    </blockquote>
</blockquote>
        </td>
    </tr>
</table>
</form></p>
        <a href="javascript: void(0)" onClick="ClosePopup();">
        <font color="#FFFFFF" style="font-size: 9pt">x</font></a><span style="font-size: 9pt">
        </span>
        </div>
</body>

3 个答案:

答案 0 :(得分:2)

试试此链接wordpress simple form plugin and display in post with shortcode

这样您就可以使用短代码将PHP代码直接包含在帖子中。我希望这对你有所帮助。

答案 1 :(得分:1)

你介意解释原因吗?如果您想在博文中显示整个网页,最好使用iframe

答案 2 :(得分:1)

如果我正确理解您的问题,您的意图是在您的wordpress帖子中包含HTML,PHP,CSS,Javascript或其他一些代码。有很多插件可以做到这一点。但是,某些插件可能无法按预期工作,可能是由于主题差异。

我最近遇到了一个名为Crayon Syntax Highlighter的插件,它与我的多个博客一起工作。按照here中指示的说明进行安装并试一试。