Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>This is pretty easy to do without other library dependancy. First your questions...</p> <p><strong>Q</strong>: Can I have two onChange events.<br> <strong>A</strong>: Yes, if you register with addEventListener/attachEvent see <a href="http://www.quirksmode.org/js/introevents.html" rel="nofollow">quirksmode primer</a> on events. You can have >1 of any kind of event.</p> <p>To attach an event to something on the page after it's loaded:</p> <pre><code>if (window.addEventListener) { window.addEventListener('load',prep,false); } else if (window.attachEvent) { window.attachEvent('onload',prep); } </code></pre> <p>Where <code>prep</code> would be a function that attaches your <code>changeQty</code> function to whatever elements you need in the page:</p> <pre><code>function prep() { /* Assuming your MainForm.elements process gets an element*/ var el=MainForm.elements["SELECT___"+productName+"___23"]; if (el.addEventListener) { el.addEventListener('change',changeQty,false); } else if (el.attachEvent) { el.attachEvent('onchange',changeQty); } } </code></pre> <p><code>onload</code>/<code>load</code> will wait until the entire DOM has loaded, that is scripts/css/HTML and graphics. Just a warning - if the page-load is complex it may not work as soon as the page renders. If you can control content at the end of the HTML (before <code>&lt;/html&gt;</code>) then you can get around this with the following (instead of attaching <code>prep</code> to <code>load</code> and defining <code>prep</code> function):</p> <pre><code>&lt;script&gt; (function() { /* Assuming your MainForm.elements process gets an element*/ var el=MainForm.elements["SELECT___"+productName+"___23"]; if (el.addEventListener) { el.addEventListener('change',changeQty,false); } else if (el.attachEvent) { el.attachEvent('onchange',changeQty); } }()); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload