PDA

View Full Version : a tag parameters


BubikolRamios
02-18-2008, 04:18 AM
Want to pass some parameters with href

1.no href at this point

<a id = 'okButton' href="#" onclick="createHref();">OK</a>


2.

function createHref()
{
var href = '../jsp/memberEdit.jsp?'
href += document.getElementById('email').value + '|';
// etc
document.getElementById('okButton').href = href;
}


this works, is there any other better/cleaner way to do that ?

Zefris
02-18-2008, 05:36 AM
I'd do something like this...


<a id = 'okButton' href="../jsp/memberEdit.jsp?">OK</a>



document.getElementById('okButton').onclick = function ()
{
this.href += document.getElementById('email').value + '|';
}


Hope that helps...