Jump to content

nerv

Expert
  • Posts

    674
  • Joined

  • Last visited

  • Days Won

    29

Everything posted by nerv

  1. Я новичек в js, поэтому, если ляпну что-то не то, прошу сильно не пинать) Конкретные, думаю, так. <html> <head> <meta charset="utf-8"> <style type="text/css"> body { background-color:#ffcc33; margin:0px; } div { background-color:#0033cc; height:100px; margin:15px; width:100px } </style> <script type="text/javascript"> function l() { var el = document.getElementsByTagName("div")[0]; alert(el.onclick); el.onclick = ev; alert(el.onclick); } function ev() { return alert(1); } </script> </head> <body onload="l()"> <div></div> </body> </html>
  2. Din Corso, может так подойдет function foo(i) { this.bar = i; } foo.prototype.baz = function() { return this.bar +=10; } var x = new foo(17); x.baz(); alert(x.bar);
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy