td height="25" align="right" class="gray">上传图片/Flash:</td>
            <td height="40" colspan="2"><input name="fileToUpload" type="file" id="fileToUpload" size="40"  class="reg" style="width:336px;height:22px"/></td>                        <input id="at" name="at" type="hidden" value="" />
        <input id="fn" name="fn" type="hidden" value="" />
        <input id="planid" name="planid" type="hidden" value="1" />
      </form></td>
  </tr>
</table>
<script language="JavaScript" type="text/javascript">
function addImgPost() {
var url = $i('url').value;
     var alt = $i("alt").value;
var fileToUpload = $i("fileToUpload").value;
var width = $i("width").value;
var height = $i("height").value;
var msg="";
var reg=/^.*?\.(jpg|bmp|png|jpeg|gif|swf|JPG|BMP|PNG|JPEG|GIF|SWF)$/;
$i("at").value = 'img';
   if(isNULL(fileToUpload)){
         msg=msg+"请选择图片或Flash!\n";
       }单击确定按钮没有反应

解决方案 »

  1.   

    没看见确定按钮,在form外面?
      

  2.   

    function addImgPost() {
    var url = $i('url').value;
         var alt = $i("alt").value;
    var fileToUpload = $i("fileToUpload").value;
    var addtype  = $i("addtype").value;
    var specs = get_radio_value(document.getElementsByName("specs"))
    var msg="";
    var reg=/^.*?\.(jpg|bmp|png|jpeg|gif|swf|JPG|BMP|PNG|JPEG|GIF|SWF)$/;
    $i("at").value = 'img';
    if(specs === undefined && addtype == 'not_edit_ads'){
    msg=msg+"请选择一个广告尺寸!\n";
    }
       if(isNULL(fileToUpload) && addtype == 'not_edit_ads'){
             msg=msg+"请选择广告图片或Flash!\n";
           }
    else if(!reg.test(fileToUpload) && addtype == 'not_edit_ads')
    {
          msg=msg+"广告图片或Flash非法!\n";
    }
    else if(!isNULL(fileToUpload)&&!reg.test(fileToUpload) && addtype == 'not_edit_ads')
    {
         msg=msg+"广告图片或Flash非法!\n";
    }
    if(isNULL(alt)){
             msg=msg+"请输入广告图片说明!\n";
         }
    if(!isValidReg(alt)){
             msg=msg+"广告图片说明包含非法字符!\n";
         }
    if(!isValidLength(alt.replace(/[^\x00-\xff]/g,"**"),36)){
             msg=msg+"广告图片说明长度超过限制!\n";
         }
    if(isNULL(url)){
             msg=msg+"请输入链接网址!\n";
         }
    if(!isValidLength(url.replace(/[^\x00-\xff]/g,"**"),1024)){
             msg=msg+"链接网址长度超过限制!\n";
         }
    if(!isValidURL(url)){
             msg=msg+"链接网址输入不合法!\n";
         }
    if(!isNULL(msg)){
             $("#error").text(msg).css("color","red"); 
             return false;
         }
    if(fileToUpload!=''){
    aU();
    }else{
    document.forms["addpost"].submit();
    }
         return true;
    }

    function addTxtPost() {
    var headline =  $i('headline').value;
    var description = $('#description').val();
    var url = $i('url').value;
    var dispurl = $i('dispurl').value;
    $i("at").value = 'txt';
    var msg="";
    if(isNULL(headline)){
             msg=msg+"请输入标题内容!\n";

           }
    if(!isValidLength(headline.replace(/[^\x00-\xff]/g,"**"),32)){
             msg=msg+"输入标题长度超过限制!\n";
         }
    if(!isValidReg(headline)){
             msg=msg+"标题内容包含非法字符!\n";
         }
         if(isNULL(description)){
             msg=msg+"请输入描述内容!\n";
         }
    if(!isValidLength(description.replace(/[^\x00-\xff]/g,"**"),70)){
             msg=msg+"输入描述长度超过限制!\n";
         }
         if(!isValidReg(description)){
             msg=msg+"描述内容包含非法字符!\n";
         }
         if(isNULL(dispurl)){
             msg=msg+"请输入显示网址内容!\n";
         }
        if(!isValidLength(dispurl.replace(/[^\x00-\xff]/g,"**"),35)){
             msg=msg+"输入显示网址长度超过限制!\n";
         }
         if(isNULL(url)){
             msg=msg+"请输入链接网址内容!\n";
         }
         if(!isValidLength(url.replace(/[^\x00-\xff]/g,"**"),1024)){
            msg=msg+"输入链接网址长度超过限制!\n";
        }
         if(!isValidURL(url)){
             msg=msg+"链接网址输入不合法!\n";
         }

    if(!isNULL(msg)){
             $("#error").text(msg).css("color","red"); 
             return false;
         }
         document.forms["addpost"].submit();
    }
    function addCpmPost() {
    var url = $i('url').value;
    var adinfo = $i('adinfo').value;
    var width = $i("width").value;
    var height = $i("height").value;
    var v = $("input[@name=screen][@checked]").val();
    $i("at").value = 'cpm';
    var msg="";
    if(isNULL(url)){
             msg=msg+"请输入弹窗网址内容!\n";
         }
         if(!isValidLength(url.replace(/[^\x00-\xff]/g,"**"),1024)){
            msg=msg+"输入弹窗网址长度超过限制!\n";
        }
         if(!isValidURL(url)){
             msg=msg+"弹窗网址输入不合法!\n";
         }
    if (v != "full" && (width < 100 || height <100)){
    msg=msg+"窗口尺寸的宽度和高度必须大于100以上!\n";
    }
    if(isNULL(adinfo)){
             msg=msg+"请输入广告描述!\n";
         }
    if(!isValidReg(adinfo)){
             msg=msg+"描述内容包含非法字符!\n";
         }
    if(!isNULL(msg)){
             $("#error").text(msg).css("color","red"); 
             return false;
         }
         document.forms["addpost"].submit();
    }

    function addHtmlPost() {
    var url = $i('url').value;
    var htmlcode = $i('htmlcode').value;
    $i("at").value = 'html';
    var msg="";
    var specs = get_radio_value(document.getElementsByName("specs"))
    if(specs === undefined){
    msg=msg+"请选择一个广告尺寸!\n";
    }
    if(isNULL(url)){
             msg=msg+"请输入链接网址内容!\n";
         }
         if(!isValidLength(url.replace(/[^\x00-\xff]/g,"**"),1024)){
            msg=msg+"输入链接网址长度超过限制!\n";
        }
         if(!isValidURL(url)){
             msg=msg+"链接网址输入不合法!\n";
         }
    if(isNULL(htmlcode)){
             msg=msg+"请输入HTML源代码!\n";
         }
    if(!isNULL(msg)){
             $("#error").text(msg).css("color","red"); 
             return false;
         }
         document.forms["addpost"].submit();
    }

    function addDlPost() {
    var url = $i('url').value;
         var alt = $i("alt").value;
    var width = $i("width").value;
    var height = $i("height").value;
    var addtype  = $i("addtype").value;
    var fileToUpload = $i("fileToUpload").value;
    $i("at").value = 'dl';
    var msg="";
    var reg=/^.*?\.(jpg|bmp|png|jpeg|gif|swf|JPG|BMP|PNG|JPEG|GIF|SWF)$/;
       if(isNULL(fileToUpload)){
             msg=msg+"请选择广告图片或Flash!\n";
           }
    else if(!reg.test(fileToUpload))
    {
          msg=msg+"广告图片或Flash非法!\n";
    }
    else if(!isNULL(fileToUpload)&&!reg.test(fileToUpload))
    {
         msg=msg+"广告图片或Flash非法!\n";
    }
    if(isNULL(width)){
             msg=msg+"请输入广告图片宽度!\n";
         }
    if(width>120){
             msg=msg+"广告图片宽度不能大于120!\n";
         }
    if(isNULL(height)){
             msg=msg+"请输入广告图片高度!\n";
         }
    if(isNULL(alt)){
             msg=msg+"请输入广告图片说明!\n";
         }
    if(!isValidReg(alt)){
             msg=msg+"广告图片说明包含非法字符!\n";
         }
    if(!isValidLength(alt.replace(/[^\x00-\xff]/g,"**"),36)){
             msg=msg+"广告图片说明长度超过限制!\n";
         }
    if(isNULL(url)){
             msg=msg+"请输入链接网址!\n";
         }
    if(!isValidLength(url.replace(/[^\x00-\xff]/g,"**"),1024)){
             msg=msg+"链接网址长度超过限制!\n";
         }
    if(!isValidURL(url)){
             msg=msg+"链接网址输入不合法!\n";
         }
    if(!isNULL(msg)){
             $("#error").text(msg).css("color","red"); 
             return false;
         }
    if(fileToUpload!=''){
    aU();
    }else{
    document.forms["addpost"].submit();
    }
         return true;
    }
    function addPfPost() {
    var url = $i('url').value;
         var alt = $i("alt").value;
    var width = $i("width").value;
    var height = $i("height").value;
    var addtype  = $i("addtype").value;
    var fileToUpload = $i("fileToUpload").value;
    $i("at").value = 'pf';
    var msg="";
    var reg=/^.*?\.(jpg|bmp|png|jpeg|gif|swf|JPG|BMP|PNG|JPEG|GIF|SWF)$/;
       if(isNULL(fileToUpload)){
             msg=msg+"请选择广告图片或Flash!\n";
           }
    else if(!reg.test(fileToUpload))
    {
          msg=msg+"广告图片或Flash非法!\n";
    }
    else if(!isNULL(fileToUpload)&&!reg.test(fileToUpload))
    {
         msg=msg+"广告图片或Flash非法!\n";
    }
    if(isNULL(width)){
             msg=msg+"请输入广告图片宽度!\n";
         }
    if(width>500){
             msg=msg+"广告图片宽度不能大于500!\n";
         }
    if(isNULL(height)){
             msg=msg+"请输入广告图片高度!\n";
         }
    if(height>500){
             msg=msg+"广告图片高度不能大于500!\n";
         }
    if(isNULL(alt)){
             msg=msg+"请输入广告图片说明!\n";
         }
    if(!isValidReg(alt)){
             msg=msg+"广告图片说明包含非法字符!\n";
         }
    if(!isValidLength(alt.replace(/[^\x00-\xff]/g,"**"),36)){
             msg=msg+"广告图片说明长度超过限制!\n";
         }
    if(isNULL(url)){
             msg=msg+"请输入链接网址!\n";
         }
    if(!isValidLength(url.replace(/[^\x00-\xff]/g,"**"),1024)){
             msg=msg+"链接网址长度超过限制!\n";
         }
    if(!isValidURL(url)){
             msg=msg+"链接网址输入不合法!\n";
         }
    if(!isNULL(msg)){
             $("#error").text(msg).css("color","red"); 
             return false;
         }
    if(fileToUpload!=''){
    aU();
    }else{
    document.forms["addpost"].submit();
    }
         return true;
    }




    function demo_headline(o){
    var headline = $i('headline').value;
    headline = encodeHtmlForText(headline);
    $i('demoheadline').innerHTML = headline;
    }
    function demo_description(o){
    var description = $('#description').val();
    description= encodeHtmlForText(description);
    $i('demodescription').innerHTML = description;
    }
    function demo_dispurl(o){
    var dispurl = $i('dispurl').value;
    dispurl = encodeHtmlForText(dispurl);
    $i('demodispurl').innerHTML = dispurl;
    }
      

  3.   

    <table width="760" class="create-ads">
              <tr>
                <td width="160" height="25" class="create-ads-adtype-m"><strong>创建图片/Flash广告</strong></td>
                <td colspan="2"  class="create-ads-adtype-m"><font color="green">前面三项必填</font></td>
              </tr>
              <tr>
                <td height="25" align="right" class="gray">上传图片/Flash:</td>
                <td height="40" colspan="2"><input name="fileToUpload" type="file" id="fileToUpload" size="40"  class="reg" style="width:336px;height:22px"/></td>
              </tr>
              <tr id="sw">
                <td height="40" align="right" class="gray">宽度:</td>
                <td colspan="2"><input name="width" type="text" id="width" size="30" maxlength="4" class="reg"/></td>
              </tr>
              <tr id="sh">
                <td height="40" align="right" class="gray">高度:</td>
                <td colspan="2"><input name="height" type="text" id="height" size="30" maxlength="4" class="reg"/></td>
              </tr>
              <tr>
                <td height="40" align="right" valign="top" class="gray">广告图片说明:</td>
                <td colspan="2"><input name="alt" type="text" id="alt" size="30" maxlength="36" class="reg" />
                  <a href="?cl=advertiser&amp;action=help&amp;width=275&amp;type=createads&amp;typeval=adalt" class="jTip" id="adalts"  name="广告图片说明"><img src="/javascript/jquery/images/question.gif" border="0" align="absmiddle" /></a><br />
                  <font color="gray" style="font-size:12px">最多18个汉字(36个字符) </font></td>
              </tr>
              <tr>
                <td height="40" align="right" valign="top" class="gray">链接网址:</td>
                <td colspan="2"><input name="url" type="text" id="url" value="http://" size="30" maxlength="1024" class="reg"/>
                  <!-- {uid}&nbsp; <a href="?cl=advertiser&amp;action=help&amp;width=275&amp;type=createads&amp;typeval=url" class="jTip" id="budegethelp"  name="链接网址{uid}说明"><img src="/javascript/jquery/images/question.gif" border="0" align="absmiddle" /></a> -->
                  <br />
                  <font color="gray" style="font-size:12px">最多1024个字符 </font></td>
              </tr>
              <tr>
                <td height="25" align="right" valign="top" class="gray">广告描述:</td>
                <td height="40" colspan="2"><input name="adinfo" type="text" id="adinfo" size="30" maxlength="100" class="reg"/>
                    <br />
                    <font color="gray" style="font-size:12px">最多50个汉字(100个字符) </font></td>
              </tr>
              <tr>
                <td align="center" class="gray"><img id="loading" src="/templates/<?php echo Z_TPL?>/images/loading.gif" style="display:none;" /></td>
                <td width="99" height="40"><img src="/templates/<?php echo Z_TPL?>/images/reg_post.jpg" width="82" height="32"  style="cursor:pointer" onclick="return addImgPost()" /></td>
                <td width="505"><span id='error'></span></td>
              </tr>
            </table>
            <?php }?>
            <?php if($adstype == 'txt') {?>
            <table width="950" class="create-ads">
              <tr>
                <td width="140" height="25" class="create-ads-adtype-m"><strong>创建主题广告</strong></td>
                <td colspan="2" class="create-ads-adtype-m">&nbsp;</td>
                <td class="create-ads-adtype-m">&nbsp;</td>
              </tr>
              <tr>
                <td height="40" align="right" valign="top" class="gray">标题:</td>
                <td colspan="2" ><input name="headline" type="text" id="headline" value="" size="30" maxlength="32" onkeyup="return demo_headline(this)" class="reg">
                  <br />
                  <font color="gray" style="font-size:12px">最多16个汉字(32个字符) </font></td>
                <td width="505" rowspan="5" valign="top" class="create-ad-title-bg"><table width="80%" align="center" style='margin-top:10px;'>
                    <tr>
                      <td height="20"><font color="#3f7c5f">效果预览:</font></td>
                    </tr>
                    <tr>
                      <td height="20"><font color="#0000cc"><span id="demoheadline">上海经济型酒店</span></font></td>
                    </tr>
                    <tr>
                      <td><span id="demodescription" style="overflow: hidden;height: 40px;">干净整洁,靠近地铁站。<br />
                        学生优惠 20%!</span><br /></td>
                    </tr>
                    <tr>
                      <td><font color="#008000"><span id="demodispurl">www.example.com</span></font></td>
                    </tr>
                  </table></td>
              </tr>
              <tr>
                <td height="40" align="right" valign="top" class="gray">内容描述:</td>
                <td colspan="2" ><textarea name="description" cols="35" rows="5" id="description"  
      

  4.   

    onkeyup="return demo_description(this)" style="width:250px;height:50px;text-align:left" class="reg"></textarea>
                  <a href="?cl=advertiser&amp;action=help&amp;width=275&amp;type=createads&amp;typeval=description" class="jTip" id="descriptions"  name="内容描述"><img src="/javascript/jquery/images/question.gif" border="0" align="absmiddle" /></a><br />
                  <font color="gray" style="font-size:12px">最多35个汉字(70个字符) </font> </td>
              </tr>
              <tr>
                <td height="40" align="right" valign="top" class="gray">链接网址:</td>
                <td colspan="2" ><input name="url" id="url" type="text"  value="http://" size="46" maxlength="1024" class="reg"/>
                  <a href="?cl=advertiser&amp;action=help&amp;width=275&amp;type=createads&amp;typeval=url" class="jTip" id="urls"  name="链接网址"><img src="/javascript/jquery/images/question.gif" border="0" align="absmiddle" /></a><br />
                  <font color="gray" style="font-size:12px">最多(1024个字符 例:<?php echo $GLOBALS['C_ZYIIS']['siteurl']?>) </font> </td>
              </tr>
              <tr>
                <td height="40" align="right" valign="top" class="gray">显示网址:</td>
                <td colspan="2" ><input name="dispurl"  id="dispurl" type="text"  size="30" maxlength="35" onkeyup="return demo_dispurl(this)" class="reg">
                  <a href="?cl=advertiser&amp;action=help&amp;width=275&amp;type=createads&amp;typeval=dispurl" class="jTip" id="dispurls"  name="显示网址"><img src="/javascript/jquery/images/question.gif" border="0" align="absmiddle" /></a><br />
                  <font color="gray" style="font-size:12px">最多(35个字符) </font> </td>
              </tr>
              <tr>
                <td height="40" >&nbsp;</td>
                <td width="104" ><img src="/templates/<?php echo Z_TPL?>/images/reg_post.jpg" width="82" height="32"  style="cursor:pointer" onclick="return addTxtPost()" /></td>
                <td width="505"><span id='error'></span></td>
              </tr>
            </table>
            <?php }?>
            <?php if(in_array($adstype,array('tw','pf','dl','wz'))) {?>
            <table width="760" class="create-ads">
              <tr>
                <td width="140" height="25" class="create-ads-adtype-m"><strong>创建<?php echo  getAdsTypeText($adstype)?>广告</strong></td>
                <td colspan="2"  class="create-ads-adtype-m">&nbsp;</td>
              </tr>
      <?php if($adstype != 'wz'){?>
              <tr id="sw">
                <td height="40" align="right" class="gray">宽度:</td>
                <td colspan="2"><input name="width" type="text" id="width" size="30" maxlength="4" class="reg"/></td>
              </tr>
                <tr id="sh">
                <td height="40" align="right" class="gray">高度:</td>
                <td colspan="2"><input name="height" type="text" id="height" size="30" maxlength="4" class="reg"/></td>
              </tr>
      <?php }?>
              <tr>
                <td align="right" valign="top" class="gray">HTML代码:</td>
                <td height="40" colspan="2"><table width="100%" border="0" cellpadding="0" cellspacing="3">
                    <tr>
                      <td width="400"><textarea name="htmlcode" cols="60" rows="10" id="htmlcode" class="reg" style="width:400px;height:200px"></textarea></td>
                      <td valign="top"><strong>标签说明</strong>:<br><br>
                        <font color="gray">{uid} 会员ID <br><br>
                        {adsid} 广告ID <br><br>
                        </font></td>
                    </tr>
                  </table>
                 <font color="gray">*<br>
     超链接标签需要填加两个元素 id onclick id值不可重复,onclick值是c涵数c('id值',event)<br>
     如: &lt;a id=a0 href=&quot;http//www.x.com&quot; onclick=c('a0'(这是ID值需对应上),event)&gt;&lt;/a&gt;。<br>
     如超链接地址需要用以上的会员ID请用标签替代
    如?uid=888 使用标签为?uid={uid}<br>超链接中两边无引号,不统计数据。<br>
                 如: &lt;a href=http//www.x.com&lt;/a&gt;。 </font></td>
              </tr>
              <tr>
                <td height="25" align="right" valign="top" class="gray">广告描述:</td>
                <td height="40" colspan="2"><input name="adinfo" type="text" id="adinfo" size="30" maxlength="100" class="reg"/>
                    <br />
                    <font color="gray" style="font-size:12px">最多50个汉字(100个字符) </font></td>
              </tr>
              <tr>
                <td align="center" class="gray"><img id="loading" src="/templates/<?php echo Z_TPL?>/images/loading.gif" style="display:none;" /></td>
                <td width="99" height="40"><img src="/templates/<?php echo Z_TPL?>/images/reg_post.jpg" width="82" height="32"  style="cursor:pointer" onclick="return addHtmlPost()" /></td>
                <td width="505"><span id='error'></span></td>
              </tr>
            </table>
            <?php }?>

            <?php if(in_array($adstype,array('wap'))) {?>
            <table width="760" class="create-ads">
              <tr>
                <td width="140" height="25" class="create-ads-adtype-m"><strong>创建WAP广告</strong></td>
                <td colspan="2"  class="create-ads-adtype-m">&nbsp;</td>
              </tr>
      <?php if($adstype != 'wz'){?>
              <tr id="sw">
                <td height="40" align="right" class="gray">广告Logo:</td>
                <td colspan="2"><input name="imageurl" type="text" id="imageurl" size="30" class="reg"/></td>
              </tr>
                <tr id="sh">
                <td height="40" align="right" valign="top" class="gray">广告语:</td>
                <td colspan="2"><textarea name="description" cols="30" rows="3" class="reg" id="description" style="height:60px"></textarea> <br />
                    <font color="gray" style="font-size:12px">可以多个用','符号分开,如 靓女最多的交友网,手机谈恋爱 </font></td>
              </tr>
      <?php }?>
              <tr>
                <td align="right" class="gray">链接地址:</td>
                <td height="40" colspan="2"><input name="url" id="url" type="text"  value="http://" size="46" maxlength="1024" class="reg"/></td>
              </tr>
              <tr>
                <td height="25" align="right" valign="top" class="gray">应用类型:</td>
                <td height="40" colspan="2"><input name="headline" type="text" id="headline" size="30" maxlength="100" class="reg"/>
                  <br />
                  <font color="gray" style="font-size:12px">如:软件 游戏 分成 </font></td>
              </tr>
              <tr>
                <td height="25" align="right" class="gray">广告描述:</td>
                <td height="40" colspan="2"><input name="adinfo" type="text" id="adinfo" size="30" maxlength="100" class="reg"/></td>
              </tr>
              <tr>
                <td align="center" class="gray"><img id="loading" src="/templates/<?php echo Z_TPL?>/images/loading.gif" style="display:none;" /></td>
                <td width="99" height="40"><img src="/templates/<?php echo Z_TPL?>/images/reg_post.jpg" width="82" height="32"  style="cursor:pointer" onclick="return addWapPost()" /></td>
                <td width="505"><span id='error'></span></td>
              </tr>
            </table>
            <?php }?>