champ_010
asked on
A Href and onClick Button
Hi I have here a link that executes a function (pops open window) nicely but when I tried to convert it to button onClick it doesn't do what it is supposed to do. Where is my error?
The link:
<a title="comment on this post" class="h5_b" href="somepage.html" onclick="popWindow(this.hr ef);return false;">Search!</a>
The button:
<input name="runSearch" type="button" class="button_small" value="Search!" onClick="javascript:popWin dow('somep age.html') ;return false;">
(the 'return false' needs to stay there)
The link:
<a title="comment on this post" class="h5_b" href="somepage.html" onclick="popWindow(this.hr
The button:
<input name="runSearch" type="button" class="button_small" value="Search!" onClick="javascript:popWin
(the 'return false' needs to stay there)
<input name="runSearch" type="button" class="button_small" value="Search!" onClick="popWindow('somepa ge.html'); return false;">
No, it needs not to be there.
But anyway, it should work.
Check this:
<input name="runSearch" type="button" class="button_small" value="Search!" onClick="popWindow('somepa ge.html')" >
But anyway, it should work.
Check this:
<input name="runSearch" type="button" class="button_small" value="Search!" onClick="popWindow('somepa
I guess this.href doesnt work in every browser
yes it works, just buttons do not have href's
ASKER
Hi, neither of your samples work for my function -- it doesn't work for the button but it does work if I changed it to a link. I need the return false there because if someone didn't have javascript turned on it would still display as a page in place of parent page instead of a pop up.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
jaysolomon's comment didn't solve the button problem but it certainly answered my question--I will probably stick with using an a href for this.
Thanks.