javascript - On change select value update href link value -
javascript - On change select value update href link value -
i have select below. below got link current eid value fixed session value. require alter dynamically when select eid value. know in getmlist function can value how update portion of codes window.open('addadselect.php?eid=' such select eid updated accordingly.
<select class='select' id='eid' name='eid' onchange='getmlist(this.value)'> </select> <tr> <td> </td> <td> <a href='#' onclick="window.open('addadselect.php?eid=<?php echo $_session['eid']; ?>', 'ads','width=500, height=750,scrollbars=yes')">select list</a> </td> </tr>
i go approach. alter link html one:
class="lang-html prettyprint-override"><a href="#" id="link" data-eid="<?php echo $_session['eid']; ?>" onclick="window.open('addadselect.php?eid=' + this.getattribute('data-eid'), 'ads','width=500, height=750,scrollbars=yes')">select list</a>
then in alter getmlist
update link data-eid
attribute:
function getmlist(eid) { document.getelementbyid('link').setattribute('data-eid', eid); // ... }
so thought on select onchange
event update data-eid
attribute of link.
javascript php
Comments
Post a Comment