开发者

javascript function on click not working [closed]

It's difficult to 开发者_StackOverflow中文版tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I have a function which prints bar code and I want to make a click event, but when I am calling my function using javascript on click, its not working, please find the code below? I am able to view it on page without onclick. I want to call get_object(id)


If you copy-pasted it, you first need to change

onclick "get_object("110091")"

To

onclick="get_object('110091')"

You forgot the = sign, and you can not use double quotes " inside an attribute value (since they are already used for separating it)


your missing the = sign it should be onclick="get..."


Is your post mistyped, or is the "=" after "onclick" actually missing? Also, you should use single-quote inside the get_object() method, or this will not properly parse.


Your tag needs to read:

... onclick="get_object('110091')" ...

note both the equals sign, and using the alternate quote characters inside - as it is your use of double quotes both to enclose the attribute and to pass the function parameter will break.

Also, why use such a complicated get_object() function? Your question is tagged HTML5 which AFAIK guarantees that getElementById() will be available.


Your get_object function does nothing but return the DOM object using the id passed in - it doesn't draw any barcodes... It sounds to me like you want:

<button type="button" button data-theme="b" id="submit" onclick="DrawCode39Barcode(get_object('inputdata').innerHTML,0);return false;">theater</button>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜