never_rain Posted May 20, 2010 Share Posted May 20, 2010 This is something very simple but no able to handle it. I am trying to do two things by one click. I would like to call a function in Javascript that'll simply display the div. Till this part, there is no problem. But at the same time, I wish to pass a variable id so that the div can use that variable to fetch values from the table. Here is what I am doing. <a href="javascript:addEducation();"> This one works fine. But when I try to send a variable, it wont do any thing. Not even this function will work. <a href="javascript:addEducation()?id=3;"> I know its very simple but Just not been able to handle it. Quick reply will really help. Thanks. Quote Link to comment Share on other sites More sharing options...
trq Posted May 20, 2010 Share Posted May 20, 2010 Firstly, there really is no need to mix JavaScript in with your markup these days. There are plenty of frameworks around that make unobtrusive code simple to achieve. You should look into using one of them. Secondly, you would need to pass the I'd numbers into your addEducation function, it's not a URL. Quote Link to comment Share on other sites More sharing options...
Ang3l0fDeath Posted May 23, 2010 Share Posted May 23, 2010 <a href="javascript:addEducation('?id=3');"> function addEducation(url_query){ alert(url_query);// to test //window.location.href=url_query; // this will forward the page to your url } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.