مشکل در جاوا اسکریپت - هفت خط کد انجمن پرسش و پاسخ برنامه نویسی

مشکل در جاوا اسکریپت

0 امتیاز

سلام من در کد زیر که گذاشتم سه تا فیلد دارم یکی گروه کالا دوم نام کالا و سوم قیمت

اول گروه کالا رو از دیتابیس گرفتم و بعد نام کالا مربوط به گروه انتخابی رو گرفتم حالا میخام قیمت نام انتخابی رو به جای سلکت در اینپوت نشون بدم input

<?php
include_once('header.php');
include_once('topmenu.php');
include_once('logo.php');
?>
 
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
    <script type="text/javascript" src="jquery-1.3.2.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $("select#type").attr("disabled","disabled");
            $("select#category").change(function(){
            $("select#type").attr("disabled","disabled");
            $("select#type").html("<option>wait...</option>");
            var id = $("select#category option:selected").attr('value');
            $.post("select_type.php", {id:id}, function(data){
                $("select#type").removeAttr("disabled");
                $("select#type").html(data);
            });
        });
        $("form#select_form").submit(function(){
            var cat = $("select#category option:selected").attr('value');
            var type = $("select#type option:selected").attr('value');
            if(cat>0 && type>0)
            {
                var result = $("select#type option:selected").html();
                $("#result").html('your choice: '+result);
            }
            else
            {
                $("#result").html("you must choose two options!");
            }
            return false;
        });
    });
    </script>
     
     <script type="text/javascript">
        $(document).ready(function(){
            $("select#price").attr("disabled","disabled");
            $("select#type").change(function(){
            $("select#price").attr("disabled","disabled");
            $("select#price").html("<option>wait...</option>");
            var id = $("select#type option:selected").attr('value');
            $.post("select_type1.php", {id:id}, function(data){
                $("select#price").removeAttr("disabled");
                $("select#price").html(data);
            });
        });
        $("form#select_form").submit(function(){
            var cat = $("select#type option:selected").attr('value');
            var type = $("select#price option:selected").attr('value');
            if(cat>0 && type>0)
            {
                var result = $("select#price option:selected").html();
                $("#result").html('your choice: '+result);
            }
            else
            {
                $("#result").html("you must choose two options!");
            }
            return false;
        });
    });
    </script>
     
     
 
     
    </head>
    <body>
    <div class="art-content-layout">
                <div class="art-content-layout-row">
                    <div class="art-layout-cell art-content">
<div class="art-post">
    <div class="art-post-tl"></div>
    <div class="art-post-tr"></div>
    <div class="art-post-bl"></div>
    <div class="art-post-br"></div>
    <div class="art-post-tc"></div>
    <div class="art-post-bc"></div>
    <div class="art-post-cl"></div>
    <div class="art-post-cr"></div>
    <div class="art-post-cc"></div>
    <div class="art-post-body">
<div class="art-post-inner art-article">
                                <div class="art-postmetadataheader">
                                        <h2 class="art-postheader">
                            <p align="center">فاکتور فروش </p>
                                        </h2>
                    <div class="cleared"></div>
                                                        </div>
                                <div class="art-postcontent">
                                 
<?php if(!isset($_SESSION['userid'])) return false;?>         
 
        <?php include "select.class.php"; ?>
        <pre>
        <form id="select_form">
 
:شماره فاکتور
<input name="id_kala" type="text" />    
 
:تاریخ
<input name="id_kala" type="text" />
 
:ساعت
<input name="id_kala" type="text" />
 
 
:کد اشتراک
<input name="id_kala" type="text" />    
 
 
:وضعیت پرداخت
<input name="id_kala" type="text" />
 
 
:وضعیت سفارش
<input name="id_kala" type="text" />
         
:گروه کالا
<select id="category">
  <?php echo $opt->ShowCategory(); ?>
</select>
 
 
:نام کالا
<select id="type">
 <option value="0">choose...</option>
</select>
 
         
:قیمت
<select  name="price"  id="price">
 <option value="0">choose...</option>
</select>
     
 
:تعداد
<input name="tedad" id="tedad" type="text" />
 
 
         
:قیمت کل
<input name="pricekol" id="pricekol" type="text" />
         
         
         
<input type="submit" value="ثبت" />
</form>
</pre>
        <div id="result"></div>
        </div>
                <div class="cleared"></div>
                </div>
 
        <div class="cleared"></div>
    </div>
</div>
 
    </body>
</html>
<?php
include_once('sidebar.php');
include_once('userprofile_module.php');
include_once('payment_module.php');
include_once('footer.php');
?>

یعنی بشه

:قیمت
 <input name="price" id="price" type="text" />

حالا چه تغییراتی باید در کد جاوا اسکریپت بالای صفحه بدم تا کار کنه

با تشکر

سوال شده دی 29, 1392  بوسیله ی 12mory (امتیاز 36)   4 6 9
دوباره تگ گذاری شد فروردین 14, 1393 بوسیله ی BlueBlade

1 پاسخ

0 امتیاز

متوجه مشکل شما نشدم
اگه می تونید یکم واضح تر بگید.

اما به هر حال میشه یه تگ گذاشت که سلکت داخلش قرار بگیره مثل span بعد innerHTML اون اسپن رو عوض کرد.

پاسخ داده شده بهمن 5, 1392 بوسیله ی unforgiven (امتیاز 11)   2
الان قیمت رو در سلکت قرار میده
میخام در اینپوت باشه
کد کامل برام بزارید طبق کدهای بالا
ممنون
...