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.

demo: http://jsfiddle.net/0529cto3/

javascript php

Comments

Popular posts from this blog

formatting - SAS SQL Datepart function returning odd values -

c++ - Apple Mach-O Linker Error(Duplicate Symbols For Architecture armv7) -

php - Yii 2: Unable to find a class into the extension 'yii2-admin' -