javascript

Best way to ask confirmation from user before leaving the page

Hey Everyone, I am currently building a registration page where if the user leaves, I want to pop up a CSS box asking him if he is sure or not. I can accomplish this feat using confirm boxes, but the client says that they are too ugly. I've tried using unload and beforeunload, but both cannot stop the page from being redirected. Using t...

How to scroll to specific item using jQuery ?

I have a big table with vertical scroll bar. I would like to scroll to a specific line in this table using jQuery/Javascript. Should I look for plug-ins for this task, or there are built-in methods ? Here is a little example to play with. Thanks a lot ! ...

mootools html and css maniplation help

Hello, I have the following HTML <div class="goto_step3"> <a href="<?= $this->sitePfx ?>/cart/paypal/" id="js_checkout_now" class="arrow">Checkout &amp; Pay</a> <? if($this->discountCodeErrorMessage): ?> <p class="error discountError"><?= $this->discountCodeErrorMessage ?></p> <? endif; ?> <div class="discountCode fncFixedHeight <?=...

What makes an input vulnerable to XSS?

Hi! I've been reading about XSS and I made a simple form with a text and submit input, but when I execute <script>alert();</script> on it, nothing happens, the server gets that string and that's all. What do I have to do for make it vulnerable?? (then I'll learn what I shouldn't do hehe) Cheers. ...

Horizontally-centering an absolute position to match a relative position

I'm trying to make a div box, containing various elements, fixed at the top of the page once the page has been scrolled so that the box would normally be out of view, but scroll normally until that point (like the behaviour at http://perldoc.perl.org/perl.html). The conditionally-fixed part is pretty simple to implement (set the positio...

jquery, position 'close icon' div in the top right of a large image

My webpage has a large image (a map). I want to position, at the top right of the image, a small icon that is for closing the map. How can I figure out the position and place the image appropriately? The image has a fixed width of 900 x 600. I have jquery on the page if that helps. I tried using $("#map").position and I have the top...

Is jQuery modular? How to trim it down?

Uncompressed, jQuery is 160KB in size. I did not see a way to exclude seldomly used parts of it like with jQuery UI. How can I reduce the (compressed and minified) file size of jQuery? I am quite concerned because dial-up lines and slow machines/browsers are very common among users of my site. My main concern is parsing duration of the ...

Showing the next month

I wonder how to set next month with showing only mondays active: i tried to do smth like that but it wont work function onlyMondaysNextMonth(date){ var day = date.getDay(); var mDate = date.getMonth() + 1; return { minDate: mDate, } return [(day == 1),'']; ...

Jquery/Javascript: Buttons added dynamically with javascript do not work.

I have a code chunk of html: <div id="chunk-1" class="chunk"> <div class="chunkText">Text<div> <button class="addChunk">Click Me</button> </div> <script> $(".addChunk").click(function(){create_chunk(this.parentNode)}) function create_chunk(after_this){ $(after_this).after(chunk_html) var i = 0 $("div.chunk...

How do I call javaScript from Objective C?

I'm developing a WebKit Safari Plugin with Xcode. How do I call JavaScript from -webPlugInStart? ...

How to create a streaming API with NodeJS

How would you go to create a streaming API with Node? just like the Twitter streaming API. What I want to do ultimately is get the first update from the FriendFeed api, and stream when a new one becomes available (if the id is different), and later on expose it as a web service so I can use it with WebSockets on my website :). So far I...

Not responding to events?

I currently have three Divs and only one of them is in focus at a given time. All of them line up in a film strip fashion. When I click a DIV not in focus, the current one moves to the left or right (depending on the direction) and the new one comes into focus. The divs can have content that has links. So my problem is that upon clicki...

Click to make body text larger | JavaScript

Please note this is just an example: <img src="img/normal-font.png" onclick="javascript:document.body.style.fontSize = '13px';" /> &nbsp; <img src="img/medium-font.png" onclick="javascript:document.body.style.fontSize = '14px';" /> &nbsp; <img src="img/large-font.png"onclick="javascript:document.body.style.fontSize = '15px';" /> The...

Twitter & Myspace SignOut link

Hi I am looking for a way to sign-out twitter & myspace from my website (they are already using Oauth for login). I am unable to find API for that thanks ...

Filtering in E4X

This is just a simple question. I'm currently using Mozilla's Rhino to develop a little webapp. As one step, I need to get a webpage and filter all of it's nodes. For doing that, I use E4X. I thought I could do this like that: var pnodes = doc..*(p); But that produces an error. How is it done right? (BTW: this is just a step for incr...

how can i refresh table content without refreshing all the page

i have a table and the content of it is all from data base ,which is a rows of student names and a columns of questions, and with this table an instructor can track the students progress of solving question on real time, so what i want is to update the only the table , without refreshing the whole page, which causes starting at the be...

Multiple Noobslides on one page

I am trying to add Multiple NoobSlides onto one page. From the sample page listed here: http://www.efectorelativo.net/laboratory/noobSlide/ I have sample 8 and want to add two Sample 5 slideshows side by side on the same page, but when I try it, the second slideshow events don't trigger. ...

Embedding a scripting engine in C++

I'm researching how to best extend a C++ application with scripting capability, and I am looking at either Python or JavaScript. User-defined scripts will need the ability to access the application's data model. Have any of you had experiences with embedding these scripting engines? What are some potential pitfalls? ...

making JavaScript generated content possible for search engines to index

Is there any way to make JavaScript generated content indexable by search engines? I remember reading something about Google parsing a generated site map, but I might be wrong here. _L ...

Determining default browser styles for various tags

I want to determine the default styles for various tag names. For example, I want to know what would be the default font-size of an h2. Is there a way to do that in Javascript ? The context : I am trying to build a live CSS editor that would let users play with the styling of the various elements on their page. For the initial configu...