javascript

Detecting valid DOM element

When I delete a DOM element using .removeChild(), the reference to the element still returns it as a valid element: var someNode = document.getElementById("someid"); if(someNode) alert('valid element'); else alert('invalid'); var p = document.getElementById('parent_id'); p.removeChild(someNode); if(someNode) alert('valid...

javscript document.getElementById in other frames

so, I have 2 frames and want to access to element from one frame into another : frame 1: <div id='someId'>...</div> frame 2: var div=document.getElementById('someId'); div.innerHTML='something'; this is somehow not functioning in Firefox so I want to be sure, can I access to element in another frame by its ID ? ...

Can anyone de-obfuscate this exploit?

I came across the following exploit due to a warning from my AV software. It originated from an adserver delivering banner ads on one of my sites. I have retrieved the content with Wget and copied to pastebin. http://pastebin.com/m6fa38fac [Warning: Link may contain malware - Do not visit from vulnerable PC.] Please note that you have...

random images from a folder

I am trying to rewrite my code below to search a folder for all the images (they will be numbered but there maybe gaps, ie not 1.jpg,2.jpg,3.jpg but instead 1.jpg,15.jpg,60.jpg for this reason i would like to search the folder, put all the images into an array and then pick one randomly each time its looped. Any help would be greatly ap...

Simple javascript form reset when certain text boxes are clicked

Morning all...thicky, newbie Rich here! I have a very simple set up, three different search options for finding product information i.e. a cascading drop down list, a product search text box and a radio button list. Ideally, I do not want the form to get cluttered with information or have to use a 'click here to reset' button. What I...

How to access php variables in Javascipt or Jquery rather than <?php echo $variable ?>

How to access PHP varibles in Javascript or Jquery? Do I have to write <?php echo $variable1 ?> <?php echo $variable2 ?> <?php echo $variable3 ?> ... <?php echo $variablen ?> I know I can store some variables in cookies,and access these values via cookies, but values in cookies are relatively stable values, moreover, there is a limit...

IE8 Crash on getStyle background-position

I've found a strange bug in Internet Explorer 8. Maybe someone can help me move around it. When I try to grab the background position of an element, using background-position-x all versions of Internet Explorer work as excepted except for IE8 that crashes. When I run el.getStyle('background-position') all browsers give me the correct v...

An image cropper: How to prevent the default drag n' drop action?

I am developing an image cropper and would like to ask you the following question: In order to prevent the default drag n' drop action when you press the left button on an image and keeping it pressed try to move the mouse, wouldn't it be cross-browser if to just use the picture as a background to a div box? Just like so: <div id="the...

Storing tab positions of multiple forms in cookie - how to prevent cluttering

I have a PHP and HTML based CMS. In each page of the CMS, there is a form with a Javascript-based tabbed dialog that switches between a number of DIVs. From each page of the CMS, it is possible to open a preview page to see the changes made, and then return to the CMS. When the user returns, I would like the same tab page to be opened a...

Changing checkbox's parent element css if checked or unchecked

Hello, Basically I have a checkbox inside a td element and I want it to have one background color when the checkbox is checked and another background color when the checkbox is unchecked. So in other words I want it to highlight whether it's checked or not. I tried to use the same solution as in here: http://stackoverflow.com/questions...

two decisons just one button

My problem now is that i need to click 2 time to do the search with right text to search. is there a way to cacth what i'm sending and update it? Is there another solution? Hello!! I have 2 radiobuttons that decides what search engine to use (google or mine), and i have 1 button that will submit a text that will be used to be searched ...

mouse event problem with nested elements

I have something similar to the following: <div onclick="divClickEvent();"> <img onmousedown="imgOnDownEvent();" /> </div> The problem is that if you mouse down on the img, the div click fires on mouse up. I tried to override the div onclick by adding an onclick="return false;" to the img element, but the div onclick is still fir...

Javascript validation of date select boxes

Hi, I have created 3 select boxes containing days, months and year. What I really would like is to check after the user has selected a date, if the date is over a year from the current date a message is displayed or so. Im a little stumped on what to do. Any gidance would be great. Thanks ...

Creating new tab / switching between Tabs in Firefox?

I am looking for a way to improve the workflow in a PHP based CMS. There is a lot of switching between the editor mode and the preview mode of the page. The editor mode is huge to load, and so I would like to open the preview mode in a different window. I don't want to use new windows or an iframe within the current window to keep the w...

Javascript OCX component return types

Noticed this strange behaviour with an ocx component. The component is normally included in the html-page with an object-tag. Using IE 7. Then it is called like so: alert(foo.getStatus()); This alerts for example "2" But when I call it like this, nothing is returned: s = foo.getStatus(); alert("> "+s); This alerts "> " alert("> "...

Why is this javascript not working?

This is in continuation of the question: http://stackoverflow.com/questions/1801960/innerhtml-working-in-ff-but-not-in-ie The above problem is resolved [ thanx to pygorex1 ] . But i would like to know why the following code snippet is not working. if (window.addEventListener){ window.addEventListener('load', addDateFormatIn...

style.visibility not working in FireFox

Hello friends, I am having an aspx page with a panel. I am using the panel as to show a messagebox. The panel id is "panMessage". The panel contains a button label "Hide". I am showing the panel using code behind but need to close the panel with JS when user clicks on Hide button. I have attached the following code with onclick event of...

Inline CSS/Javascript into a HTML file

I am looking for a simple commandline script/program to automatically "inline" all external css and javascript references for a html file. I basically want to create a single self-contained html file suitable for sending via E-Mail. An additional bonus would be if it could also inline images as data: UIRs, but that part is not so importa...

Can WatiN disable JavaScript in IE?

Hi I want WatiN to disable JavaScript for some of my tests but can't find any obvious way to do it. Is it possible? I am using IE specifically. Thanks in advance, Ciaran ...

WPF + JavaScript

How I can access to wpf methods from javascript??? ...