0
First <a tag> onclick
--> doesn't work (a tag onclick
) but second button onclick
--> works.ボタンonclickのみが動作します。<a onclick> tag doesn't work in javascript when sending parameter to another page
Anyone knows what's the problem with <a>
tag??
function content(frm) {
var url = "noticeContent.jsp";
var title = "test";
var status = "toolbar=no,directories=no,scrollbars=no,resizable=no,status=no,menubar=no,width=240, height=200, top=0,left=20"
window.open("", title,status);
frm.target = title;
frm.action = url;
frm.method = "post";
frm.submit();
}
<form name="f_name">
<input type="hidden" name="a" value="1">
<input type="hidden" name="b" value="2">
<td><a href="javascript:" onclick="content(this.form)"></a></td>
<td><input type="button" onclick="javascript:content(this.form)"></td>
</form>
works fine here. done any basic debugging, like checking the console? –
can you tell mewhat it pops when clicking a tag? iam only getting about:blank, and i get right page when clicking button. its freaking weird –
ah yeah. here it is: '' is just a link, and does NOT have a '.form' attribute, so you're passing an undefined value to the function. the input IS a form element, so it does have a .form attribute to point at the form it's a member of. –