473,394 Members | 1,840 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

retrieve selected value

how do I get a cell value for selected qty? Please help!!!
below is the code.

Thanks,

Expand|Select|Wrap|Line Numbers
  1. <?xml version = "1.0" encoding = "utf-8"?>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  3.     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  4.  
  5. <html xmlns = "http://www.w3.org/1999/xhtml">
  6.  
  7.  
  8.    <head>
  9.     <title>Incredible Roadside Assistance&reg; - Products</title>    
  10.  
  11.     <object id = "Product"
  12.         classid = "CLSID:333C7BC4-460F-11D0-BC04-0080C7055A83">
  13.         <!--supply file location and name-->
  14.         <param name = "DataURL" value = "Products.txt" />
  15.         <!--specify whether first row is a header-->
  16.         <param name = "UseHeader" value = "TRUE" />
  17.         <!--denote the data field start and end -->
  18.         <param name = "TextQualifier" value = "*" />
  19.         <!--denote the field delimiter-->
  20.         <param name = "FieldDelim" value = "|" />
  21.     </object>
  22.  
  23.     <script type = "text/javascript">
  24.  
  25.     function submitForm( )
  26.     {    
  27.        alert("submit");
  28.  
  29.        var fileSysObj = new ActiveXObject("Scripting.FileSystemObject") ;
  30.        var textFile = fileSysObj.CreateTextFile("Order.txt", true) ;
  31.        var qty="";
  32.        alert( getText(document.getElementById("qty")) );       
  33.        textFile.WriteLine("total") ;
  34.        textFile.Close( ) ;       
  35.        window.alert("A file has been created.") ;
  36.  
  37.  
  38.     }
  39.  
  40.     function getText(el)
  41.     {
  42.         if (el.textContent) return el.textContent;
  43.         if (el.innerText) return el.innerText;
  44.         return el.innerHTML.replace(/<[^>]*>/g,'');
  45.     }
  46.  
  47.  
  48.     function resetForm( )
  49.     {
  50.     //set event's return value to false to override its default behavior
  51.     window.event.returnValue = false ;
  52.     //display a msgbox with OK and Cancel buttons on it
  53.     if (confirm("Are you sure you want to clear the form?"))
  54.        {
  55.         //let the default behavior occur
  56.         window.event.returnValue = true ;
  57.        }
  58.     else
  59.        {
  60.         //do nothing
  61.        }
  62.     }
  63.  
  64.     function createFile( )
  65.     {
  66.  
  67.     }
  68.  
  69.     //]]>
  70.     </script>
  71.  
  72.    </head>
  73.  
  74.    <body style = "background-color: bisque">
  75.    <form id="form1" onsubmit= "submitForm( )" onreset="resetForm( )" action=" ">
  76.     <h1 style = "text-align:center">Incredible Roadside Assistance&reg; - Product Information</h1>
  77.     <div style = "text-align: center">
  78.        <select onchange = "Product.Sort = this.value; Product.Reset( ); ">
  79.         <!--sort by Product ID data field in ascending order-->
  80.         <option value = "ProdID">Product ID - Ascending</option>
  81.         <!--sort by Product ID data field in descending order-->
  82.         <option value = "-ProdID">Product ID - Descending</option>
  83.         <!--sort by Product Name data field in ascending order-->
  84.         <option value = "ProdName" selected>Product Name - Ascending</option>
  85.         <!--sort by Product Name data field in descending order-->
  86.         <option value = "-ProdName">Product Name - Descending</option>
  87.         <!--sort by Product Desc data field in ascending order-->
  88.         <option value = "ProdDesc">Product Description - Ascending</option>
  89.         <!--sort by Product Desc data field in descending order-->
  90.         <option value = "-ProdDesc">Product Description - Descending</option>
  91.        </select>
  92.     </div>
  93.     <p>
  94.     <span style = "background-color: bisque; position: absolute;
  95.        margin-left: 15%; width: 67%; border-style: ridge; text-align: center;
  96.        padding: 1em">
  97.        <table id="myTable" datasrc = "#Product" >
  98.         <thead>
  99.            <tr>
  100.             <th>Product ID</th>
  101.             <th>Product Name</th>
  102.             <th>Description</th>
  103.             <th>&nbsp;</th>
  104.             <th>Qty</th>
  105.             <th></th>
  106.            </tr>
  107.         </thead>
  108.         <tbody>
  109.            <tr>
  110.               <td>
  111.                 <span datafld = "ProdID">Product ID goes here.</span>
  112.               </td>
  113.               <td>
  114.                 <span datafld = "ProdName">Name goes here.</span>
  115.               </td>
  116.               <td>              
  117.                 <span datafld = "ProdDesc">Description goes here.</span>
  118.               </td>
  119.               <td>
  120.                 <span>
  121.                    <img datafld = "Image" alt="Image goes here."></img>
  122.                 </span>
  123.               </td>
  124.               <td>
  125.             <span>
  126.             <select ID="qty" Name="qty" onchange = "Product.Sort = this.value; ">
  127.                     <option value = "0">0</option>
  128.                     <option value = "1">1</option>
  129.                     <option value = "2">2</option>
  130.                     <option value = "3">3</option>
  131.                     <option value = "4">4</option>
  132.                     <option value = "5">5</option>
  133.                     <option value = "6">6</option>
  134.                     <option value = "7">7</option>
  135.                     <option value = "8">8</option>
  136.                     <option value = "9">9</option>
  137.                     <option value = "10">10</option>
  138.                        </select>
  139.                 </span>
  140.               </td>
  141.            </tr>
  142.         </tbody>
  143.        </table>
  144.        <table>
  145.         <tr>
  146.             <td>
  147.                 <input type="submit" id="btnSubmit" value="Submit" />
  148.                 &nbsp;&nbsp;
  149.                 <input type="reset" id="btnCancel" value="Cancel" />
  150.             </td>
  151.         </tr>
  152.        </table>
  153.      </span>
  154.     </p>
  155.     </form>
  156.    </body>
  157. </html>
Apr 26 '10 #1
1 2007
Dormilich
8,658 Expert Mod 8TB
form controls always have the .value attribute/property, holding their, er, value.

PS. that code only works in IE (just to have it mentioned)
Apr 27 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Jefferis NoSpamme | last post by:
Hi folks, Trying to fill in a gap in my understanding of php, and so this is rather newbish: I have created a form where a user selects 2 items from a list of 8 values. That form field is...
1
by: Cipher | last post by:
I've got a DropDownList control on my ASP.Net page and I cannot retrieve it's value (via its SelectedValue property) if the control is hidden or disabled. Once I set the control to visible and...
2
by: Rob | last post by:
Hi all, I've got multiple sets of radio button that are dynamically created in code and populated by a database query. The query returns about 20 recordsets with 3 radio buttons per recordset and...
0
by: george_Martinho | last post by:
It seems that the ASP.NET Microsoft team didn't think about this!! The profilemanager class has the following methods: - DeleteInactiveProfiles. Enables you to delete all profiles older than a...
2
by: Micela | last post by:
Hi, Please help me out in this task. I have a filed in the database of datetime. and 3 dropdown lists in the page. Im using Asp.net with VB coding. The three dropdown lists are 1.for date...
1
by: dudis3 | last post by:
Hello, I have this problem, I have populated a multiselect ListBox, but now I need to retrieve selected values, and use them as a parameters on the url e.g...
1
by: prashu | last post by:
how to retrieve a value selected in a drop down list box using jsp
21
by: giandeo | last post by:
Hello Experts. Is it possible to retrieve the value from a populated pull down menu from a database and then use that value to access the same database to get the related fields. Example: ...
1
by: divya | last post by:
Hello, I used the below code to move selected items between two listboxes Left and Right:- <%@ Page Language="C#" AutoEventWireup="true" CodeFile="TestPopup.aspx.cs" Inherits="TestPopup" %> ...
10
by: puT3 | last post by:
I want to get the value from Product_Price field which it will display it record on a text box based on a product that is selected from a list box. Product Table Product_ID Product_Name...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.