10
7
2011
13

javascript:void(0);什么意思

取自:http://tieba.baidu.com/f?kz=264205010

JavaScript中void是一个操作符,该操作符指定要计算一个表达式但是不返回值。
void 操作符用法格式如下: 
1. javascript:void (expression)
2. javascript:void expression 
expression 是一个要计算的 JavaScript 标准的表达式。表达式外侧的圆括号是可选的,但是写上去是一个好习惯。 (实现版本 Navigator 3.0 )
你可以使用 void 操作符指定超级链接。表达式会被计算但是不会在当前文档处装入任何内容。 
下面的代码创建了一个超级链接,当用户点击以后不会发生任何事。当用户点击链接时,void(0)无返回值,如果输出是undefined,但在 JavaScript 上没有任何效果。 

<A HREF="javascript:void(0)">单击此处什么也不会发生</A>

javascript:void(0)  仅仅表示一个死链接?

 

me 小结:

 貌似void(0)一定要传参数给它(多个似乎也行……),但其没有返回值,so如果自己写个空方法如function test(){},也可以javascript:test();,就是说什么也不执行的样子,其实最简洁的做法是:javascript:;(或者干脆连分号也不用了……)。

 

参考资料:

  http://blog.csdn.net/cnkiminzhuhu/article/details/2071143:javascript:void(0)什么意思

Category: Web摘记 | Tags: javascript | Read Count: 3136
Avatar_small
لی ویوسوہ ہو یار 说:
2021年7月26日 00:50 I found this is an informative and interesting post so i think so it is very useful and knowledgeable. I would like to thank you for the efforts you have made in writing this article. soap2day app
Avatar_small
لی ویوسوہ ہو یار 说:
2021年7月27日 01:06

I really impressed after read this because of some quality work and informative thoughts . I just wanna say thanks for the writer and wish you all the best for coming!. dell precision t1700

Avatar_small
لی ویوسوہ ہو یار 说:
2021年7月27日 15:11

Cool stuff you have got and you keep update all of us. hts 프로그램 분양

Avatar_small
لی ویوسوہ ہو یار 说:
2021年7月30日 23:37

I can see that you are an expert at your field! I am launching a website soon, and your information will be very useful for me.. Thanks for all your help and wishing you all the success in your business. תיקון פאצ

Avatar_small
لی ویوسوہ ہو یار 说:
2021年7月31日 21:13

Thank you for some other informative website. The place else may just I get that kind of information written in such a perfect method? I have a venture that I am simply now running on, and I’ve been at the glance out for such info. rantaiqq daftar

Avatar_small
لی ویوسوہ ہو یار 说:
2021年7月31日 21:32

You’ve got some interesting points in this article. I would have never considered any of these if I didn’t come across this. Thanks!. https://kctapp.com/

Avatar_small
seoservvise 说:
2021年8月05日 21:17

Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with extra information? It is extremely helpful for me. what is smite

Avatar_small
لی ویوسوہ ہو یار 说:
2021年8月14日 23:26

I am very enjoyed for this blog. Its an informative topic. It help me very much to solve some problems. Its opportunity are so fantastic and working style so speedy. wedding videographer

Avatar_small
لی ویوسوہ ہو یار 说:
2021年8月24日 14:28

Can nicely write on similar topics! Welcome to here you'll find out how it should look. thanks for visiting

Avatar_small
seoservise 说:
2021年12月09日 22:04

Your work is very good and I appreciate you and hopping for some more informative posts. Thank you for sharing great information to us. lottery sambad

Avatar_small
Alice 说:
2022年2月22日 20:51

I really impressed after read this because of some quality work and informative thoughts . I just wanna say thanks for the writer and wish you all the best for coming!.<a href="https://sketchfab.com/Stessiging91">Find the best Font</a>

Avatar_small
johny 说:
2022年11月22日 23:40 I really thank you for the valuable info on this great subject and look forward to more great posts. Thanks a lot for enjoying this beauty article with me. I am appreciating it very much! Looking forward to another great article. Good luck to the author! All the best! Satta king
Avatar_small
Johny 说:
2022年11月27日 17:38 I have read all the comments and suggestions posted by the visitors for this article are very fine,We will wait for your next article so only.Thanks! deep web

登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter

Host by is-Programmer.com | Power by Chito 1.3.3 beta | Theme: Aeros 2.0 by TheBuckmaker.com