dom

Simplehtmldom - curl, loops, arrays?

Hello. Pse forgive what is most likely a stupid question. I've successfully managed to follow the simplehtmldom examples and get data that I want off one webpage. I want to be able to set the function to go through all html pages in a directory and extract the data. I've googled and googled but now I'm confused as I had in my ignora...

[SOLVED] javascript insertBefore() Method

I'm trying to insert a TH as the first column. But so far always put it at the end of all columns. Any help will be appreciate it. Thanks var someNode = document.createElement("th"); someNode.innerHTML = "Hello"; var sp = document.getElementById("table").getElementsByTagName("thead")[0].getElementsByTagName("tr")[0]; var ref = document...

JQuery elements ignoring click() code if added to DOM after pageload

So I have some code and I add an element to the DOM after pageload (the second link in the below example) however this newly added element ignores all functions defined for it. So for the example below I want all links in div's with the test class to show an alert. Works fine for the link hard coded but the one added afterwards ignores...

How to only modify "text" while modifying the dom using javascript

I'm trying to write an "unbreakable" class using jQuery, so that: <span class=unbreakable> some text in here maybe with a <span title="tag">tag</span> or something </span> would have each space replaced with &nbsp;. The problem is, if I do something like $(".unbreakable").html ( replaceAll($(".unbreakable").html(), " ", "&...

How to create a floating PANEL in BHO dynamically?

Inserting the floating div through BHO in C#.NET modifies the existing DOM for the web page. I do not want to modify the DOM. Is there a way in which i can dispaly a text without even touching DOM? Like a floating panel or something? ...

javascript dom insertion. Performance vs Leak ?

Hi. I'm wondering what is the right way to do dom insertion of complex elements. Until now, (with jQuery) I used to first build my element and to insert it once finished. I thought that it was the most efficient, since DOM access is costly performance-wise. But with native js, I read that to avoid memory leaks, each new dom node shou...

Javascript/DOM Why is does my form not support submit()?

This is my first time working with asp.net and javascript, so I don't know a lot of the nice web resources, or much about debugging javascript. I'm looking to find out why on line oFormObject.submit(); Microsoft JScript runtime error: Object doesn't support this property or method. I'm using links to function as buttons because I'm t...

Scraping single table from HTML using JavaScript

Here's my problem: there's an internal issue tracking system that has a nice summary page (number of open issues broken down by developer, etc.) However, the compact summary table is surrounded by boilerplate cruft (navigational menu, search box, etc.) I'd like to embed the summary table on our team's page, but not the surrounding cruft...

How can I preserve the page scroll position when opening a dialog in response to a link trigger?

I would like to know how I can maintain the scroll position when I open a jQuery dialog. Here is the code I'm using to open my dialog: <a class="link" onclick="openmyDialog();" href="#">Open a dialog</a> And the function : function openmyDialog() { $("#dialog").dialog('destroy'); $("#dialog").html("msg"); $("#dialog").di...

Jquery tranversing DOM to find consecutives values

Thanks for looking, all helpful answers are voted up. This is my markup. I'm trying to find 2 consecutive divs cmk1 and cmk2 with the content RIGHT and HERE in consecutive order. div id 1 shouldn't match because there's a right but not here. div id 3 shouldn't match because there's a here but no right. I'm trying to find something t...

jQuery replace strings in many classes

I'm trying to use jQuery to replace all occurrences of a particular string that occurs in a certain class. There are multiple classes of this type on the page. So far I have the following code: var el = $('div.myclass'); if(el != null && el.html() != null ) { el.html(el.html().replace(/this/ig, "that")); } This doesn't work if t...

IE: why isn't AJAX resulting HTML updated in DOM?

I'm loading html content via ajax onto a div (using mootools 1.11 and squeezebox, if it matters). In the content that I load I have some JS that manipulates some of the loaded HTML objects. Everything works fine in FF, but when I load it in IE (tested on IE7 for now) the code fails with "'null' is null or not an object. A quick test show...

Disabling key functionality in browser

I am writing an application in JavaScript (w/ JQuery). The application has a lot of functionality that the user needs to access quickly and possibly at the same time (you could think of it as a game, even though it's not a game) so I've set it up to use the keyboard. I've got a prototype of the system working (in Chrome, at least), but...

PrototypeJS observe windows dimensions change ?

Hi, I'm trying to create my own 'modal' window since none of these currently existing for PrototypeJS fits my needs. The problem is observing document.documentElement for change of height and width of viewport ( or document.body, depending on Quirks/Standard mode ). ...

Using a dynamic <script> (a <script> appended to the DOM by JavaScript) to load and initialize Clicky Web Analytics

I'm creating an HTML/JavaScript widget to be used on third-party sites. This widget is generated by a <script> that our customers will insert on their page. The <script> creates an <iframe> in the customer's domain, and then creates and inserts all of that <iframe>'s content using JavaScript. It's important that this <iframe> contain Cl...

Code smell: Passing Javascript variable names and values from server script (ASP.NET)

What are some good ways to deal with this messy and unnecessary and not-really-dynamic generation of JavaScript: var <%# JavascriptId %> = new BusinessChart( '<%# JavascriptId %>',<%# CurrentUserId %>,'<%# ChartId %>' ,'<%# Helper.GetBaseUrl() %>','<%# ChartPath %>' ,'<%# Helper.ResolveUrl("~", true) %>' ); <%# JavascriptId...

How to prevent form submiting before DOM is ready?

I'm using javascript to validate the form, but can't handle the case when the form is submitted before DOM is ready I tried : <form method="POST" disabled="disabled"> <input type="submit" /> </form> But the form can still be submited. ...

Best book to learn web development for a professional developer?

I'm a professional software developer. I've been programming in a lot of different languages over the course of more than two decades now. Picking up a new programming language is very easy for me. However, I have no knowledge or experience whatsoever developing modern AJAXy web applications. What I need is a book that gives me a goo...

DOM Window unload event, is it reliable?

Can I rely on the window unload event to be triggered when a user closes a tab/window/browser? Edit: Found a list of what triggers the unload event in IE. http://msdn.microsoft.com/en-us/library/ms536973%28VS.85%29.aspx I would like to know in which edge cases the unload event won't be triggered. ...

Please wait modal overlay before waiting for a function with a heavy workload without setTimeout()?

This is a simplified example, to make sure that there are no asynchronous fading/animation functions involved. I want, that the background is red when the function with the heavy workload works and turns to black, when it is ready. What actually happens is, that most times the background will turn directly to black, after the function i...