English 中文(简体)
我可以把“Javascriptmarklet”光指在浏览器窗上的形象。 例如:blah.com/blah.jpg?
原标题:Can I call a Javascript bookmarklet over just an image in browser window. e.g.:blah.com/blah.jpg?

If I m at a url... say http://i.imgur.com/JcxmE.jpg where it is just the image file, how can I make a window/div appear over the image when the bookmarklet is called? Instapaper does this. So far my bookmarklet loads an external javascript file, which in turn creates a div and appends it to the body. This doesn t work when it is just an image. Ideas? Thank you!

最佳回答

Alright it looks like firefox still renders a DOM even over images. The hello world example works only if you stick it inside a bookmarklet, but not straight in the url bar.

在这里,只要您的浏览器使OMM甚至在纯图像中发挥作用,就是一个例子。 它将在集装箱内插入图像。

javascript:(function(){
  var doc = document,
      image = doc.getElementsByTagName( img )[0],
      container = doc.createElement( div );

  doc.body.removeChild(image);
  container.appendChild(image);
  doc.body.appendChild(container);
})();
问题回答

最好不要像你一样,至少要看一下吗? 甚至像<代码>javascript:alert(a) Hello World ; don t work on a culture. Try that Code for yourself.





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签