⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 add2.php

📁 php中英版本 仿alibaba贸易平台
💻 PHP
📖 第 1 页 / 共 2 页
字号:
<script language="JavaScript">

var button_clicked = '';
var order = []
var sep = ' ';
var max_move = 10;

function onSubmit()
{
    var form = document.form;
    var current_category_id = split(form.current_category_id.value, sep);

    if(button_clicked)
    {
        var categories = form.category_id.options;
        var selected_categories = form.right_category_id.options;

        if(button_clicked == 'select')                // Move to right pane
        {
            addOptions(categories, selected_categories );

            var selected_str = '';
            for(var i = 1; i < selected_categories.length; i++) selected_str += selected_categories[i].value + sep;
            form.current_category_id.value = selected_str;
        }
        else if(button_clicked == 'deselect')        // Remove from right pane
        {
            removeOptions(selected_categories, categories );

            var selected_str = '';
            for(var i = 1; i < selected_categories.length; i++) selected_str += selected_categories[i].value + sep;
            form.current_category_id.value = selected_str;    //这是最后提交的ID数字
        }
        button_clicked = '';
        return false;
    }
    else
    {
        return true;
    }
}

function onClick(button)
{
    button_clicked = button;
}

function split(string, sep)
{
    var items = string.split(sep);
    var result = [];
    for(var i = 0; i < items.length; i++)
        if(items[i]) result[result.length] = items[i];

    return result;
}

function addOptions(src, dst )
{
    var selected_value = [];
    var selected_text = [];

    // Get items from dst
    for(var i = 0; i < dst.length; i++)
    {
        selected_value[selected_value.length] = dst[i].value;
        selected_text[selected_text.length] = dst[i].text;
    }

    // Get items from src
    for(var i = 1; i < src.length; i++)
    {
        if(src[i].selected)
        {
            var exists = 0;
            for(var j = 1; j < dst.length; j++)
            {
                if(dst[j].value == src[i].value)
                {
                    exists = 1;
                    break;
                }
            }

            var len = selected_value.length;
            if( len > 4  )
            {
                alert("最多可选择四个类目。");
                return ;
            }


            if(!exists)
            {

                selected_value[selected_value.length] = src[i].value;
                selected_text[selected_text.length] = src[i].text;
            }
        }
    }

    // Clear dst except the first item
    while(dst.length > 1) dst[1] = null;

    // Fill the dst box
    for(var j = 0; j < selected_value.length; j++)
    {
        if( selected_value[j] == "" )
            continue;
        dst[dst.length] = new Option(selected_text[j], selected_value[j]);
    }
}

function removeOptions(src, dst)
{
    for(var i = 1; i < src.length; i++)
    {
        if(src[i].selected)
            src[i--] = null;
    }
}

</script>

   <br>
        <table width="95%" border="0" cellpadding="0" cellspacing="0">
        <tr>
        <td class="tbg3">新增公司信息</td>
        </tr>
        <tr>
        <td class="tbg2">为提高您填写的信息的发布效率,请用汉字如实填写以下信息。 (打<font color="#ff0000">*</font>为必填项)</td>
        </tr>
        </table>
        <?
        echo  $reason_1;
        ?>
<center>

<script language="JavaScript">
<!--
javascript:window.history.forward(1);
-->
</script>


<table border="0" align="center" cellpadding="2" cellspacing="0" width="95%" align=center>
<tr>
<td colspan="2">


</td>
</tr>

<form ACTION='add.php' METHOD="POST" name="form" onSubmit="return onSubmit()" >
<?php
echo "
<INPUT type=hidden value=2 name=submit_ok>
<input type='hidden' name='viewName' value=\"$viewName\">
<input type='hidden' name='profile' value=\"$profile\">

<input type='hidden' name='product1' value=\"$product1\">
<input type='hidden' name='product2' value=\"$product2\">
<input type='hidden' name='product3' value=\"$product3\">

<input type='hidden' name='manufacturingType' value=\"$manufacturingType\">
<input type='hidden' name='tradeType' value=\"$tradeType\">
<input type='hidden' name='serviceType' value=\"$serviceType\">
<input type='hidden' name='govOtherType' value=\"$govOtherType\">

<input type='hidden' name='principal' value=\"$principal\">
<input type='hidden' name='phone' value=\"$phone\">
<input type='hidden' name='fax' value=\"$fax\">

<input type='hidden' name='province' value=\"$province\">
<input type='hidden' name='city' value=\"$city\">
<input type='hidden' name='addr' value=\"$address\">
<input type='hidden' name='zip' value=\"$zip\">
<input type='hidden' name='homepage' value=\"$homepage\">
<input type='hidden' name='email' value=\"$email\">

<input type='hidden' name='companyId' value=\"0\">
<input type='hidden' name='annualRevenue' value=\"$annualRevenue\">
<input type='hidden' name='keyClients' value=\"$keyClients\">
<input type='hidden' name='employeesCount' value=\"$employeesCount\">
<input type='hidden' name='country' value=\"CN\">
<input type='hidden' name='phoneCountry' value=\"86\">
<input type='hidden' name='faxCountry' value=\"86\">
<input type='hidden' name='bank' value=\"$bank\">
<input type='hidden' name='account' value=\"\">
<input type='hidden' name='feedbackFlag' value=\"Y\">
<input type='hidden' name='trustpassFlag' value=\"$trustpassFlag\">
<input type='hidden' name='mobileNo' value='mobileNo'>
<input type='hidden' name='current_category_id' value=\"$current_category_id\">
<input class=f2_v type=\"hidden\" name=\"businessType\" value=\"$businessType\">
";
?>

</table>

<br>
    <table width="95%" class="fbg1">
         <tr>
            <td>第二步:请选择主营业务(最多可选择四个类目)</td>
         </tr>
    </table>

<table border=0 width="95%" align=center cellpadding="2" cellspacing="3">
<tr valign=top>
<td>
请根据贵公司的业务重点选择所属行业类目。您最多可以选择4个类目(请务必把主营业务选择成为第1类目)。
<br>
操作方法:
<ul>
<li>按住键盘左下角的<font color="990000">Ctrl</font>键不放,同时鼠标点击选择您要求的类别,这样可以一次选中多个类目;</li>
<li>选定类别后,点击右面的“<font color="990000">添加到主营业务 >></font>”按钮; </li>
<li>页面刷新后,如果下面的条框内出现您要求的类目字样,说明已经完成选择; </li>
<li>如果您发现选择有误,使用“<font color="990000"><< 删除</font>”键清除已有的选择。</li>
<li>最后,按“<font color="990000"> 提交 </font>”按钮,发送您的信息。</li>
</ul>
</table>

<table border=0 cellpadding="2" cellspacing="3" width="95%" align=center align="center" bgcolor="#f5f5f5">
<tr>
<td valign=top><b><font class=m>所有类目</font></b><br>
<select name="rootCatId" onchange="changeCategory(this)">
  <option selected>------------请选择合适您的行业大类------------</option>
</select>
<br><br>
<select name="category_id" Size=15 MULTIPLE>
  <option selected>------------请选择合适您的行业小类------------</option>
</select>

</td>

<td><input type="submit" name="Add" value="添加到主营业务 >>" onClick="onClick('select')">
</td>
</tr>
<tr>
<td valign=top><font class=m><b>主营业务类目:</b></font><font color="ff0000"> * </font><br>
<SELECT NAME="right_category_id" Size=6 MULTIPLE>
<OPTION  VALUE="">-------------您已经选择了以下类目-------------
</Select>
</td>
<td align=left>
<input type="submit" name="Delete" value="<< 删除" onClick="onClick('deselect')">
</td>
</tr>
</table>


<br>
<table border=0 width="95%">
<tr><td align=center>
<input type="submit" name="Ok" value=" 提 交 ">
</td>
<td align=center>
<input type="submit" name="Previous" value=" 返回上一页 ">
</td>
</tr></table>
</form>


<script>
    //category methods
    function Category(id,title) {
        this.id = id;
        this.title=title;
        this.boardlist=new Array();
        this.addBoard=addBoard;
        this.getOptions = getOptions;
    }

    function addBoard(board) {
        this.boardlist = this.boardlist.concat(board);
    }

    function getOptions() {
        var tmp = new Array();
        for(var i=0; i < this.boardlist.length;i++) {
            var b = this.boardlist[i];
            tmp[i]= b.getOption();
        }
        return tmp;
    }

    //board methods
    function Board(catid,id,title,total) {
        this.catid=catid;
        this.id=id;
        this.title=title;
        this.getOption=getOption;
    }

    function getOption() {
        return new Option(this.title,this.id);
    }

    function changeCategory(list) {
        if (list.selectedIndex<=0) {
            catForm.options[0].selected=true;
            var len = boardForm.options.length;
            for (var i=len-1;i>0;i--){
                boardForm.options[i]=null;
            }
        }
        else {
            var boards = catArr[list.selectedIndex-1].getOptions();
            var len = boardForm.options.length;
            for (var i=len-1;i>0;i--){
                boardForm.options[i]=null;
            }

            for (var i=0;i<boards.length;i++) {
                boardForm.options[i+1]=boards[i];
            }
        }
        boardForm.options[0].selected=true;
    }

    function selectBoard(catid,bid) {
        for(var i=0;i<catForm.length;i++) {
            if (catForm.options[i].value==catid) {
                //alert("get Category");
                catForm.options[i].selected=true;
                changeCategory(catForm);
                break;
            }
        }
        for(var i=0;i<boardForm.length;i++) {
            if (boardForm.options[i].value==bid) {
                //alert("get Board");
                boardForm.options[i].selected=true;
                break;
            }
        }
    }

    //static methods
    var catArr = new Array();
    var cur;

      cur = new Category('1','农林牧渔');
      catArr = catArr.concat(cur);
<?php
$tablename = "c_catalog";
include("../connect.php");
$sql="select catalog_id,catalog from $tablename where parent_id=1";
$query=mysql_query($sql);
while($array=mysql_fetch_array($query)){
$catalog_id=$array[catalog_id];
$catalog=$array[catalog];
echo "cur.addBoard(new Board('1','$catalog_id','$catalog'))\n";
$catalog_id=$array[catalog_id];
$catalog=$array[catalog];

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -