Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Page keeps on crashing the browser

  1. #1
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default Page keeps on crashing the browser

    Hi,

    I have this page that constantly crashes IE, FF and the computer.

    HTML Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    
    <head>
    <link rel="stylesheet" type="text/css" href="tabcontent.css" />
    
    <script type="text/javascript" src="tabcontent.js">
    
    /***********************************************
    * Tab Content script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
    * This notice MUST stay intact for legal use
    * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
    ***********************************************/
    
    </script>
    <link rel="stylesheet" href="dhtmlgoodies_calendar.css" media="screen" /><link /><link></link>
    <script language="JavaScript" src="dhtmlgoodies_calendar.js"></script>
    
    <meta http-equiv="Content-Language" content="en-au" />
    
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
    <title>Calendar</title>
    <style>
    body	{
    
    	font-family:Verdana;
    	font-size:10pt;
    
    }
    p	{
    
    	font-family:Verdana;
    	font-size:10pt;
    }
    
    .butt	{
    
    	font-family:Verdana;
    	font-size:8pt;
    }
    
    td	{
    
    	font-family:Verdana;
    	font-size:10pt;
    }
    </style>
    <script>
    function changeDate()	{
    
    	var selectedDate = document.forms['booking'].elements['date'].value
    	if (selectedDate == "")	{
    	
    		alert("Please select a date before continuing.");
    		return false;
    	}
    	else	{
    	window.location = "calendar.php?date="+selectedDate;
    	}
    }
    
    function toggle(element,mode)	{
    
    	el = document.getElementById(element)
    	el.style.display = mode
    }
    
    setTimeout("toggle('main','block');toggle('load','none')",3000);
    </script>
    
    </head>
    
    <body onload="">
    <div id="load" style="font-family:Verdana, Arial, Helvetica, sans-serif;">
      <p>Loading...</p>
      <p>(This may take a while because of the server load and simultanious proccesses at once) </p>
    </div>
    <div id="main" style="display:none">
    <div align="left"><form action="calendar.php" name="booking" method="GET">
    
    	<p>Date: <input type="text" name="date" size="20" class="butt" readonly="" />
    	<input type="button" value="Select Date" name="sDate" class="butt" onclick="displayCalendar(document.forms[0].elements['date'],'dd.mm.yyyy',this)" /><font></font>
    	<input type="button" value="Change" name="change" class="butt" onclick="changeDate();" /></p></form><p></p>
    </div> 
    <?php
    
    $msgFree = "Free."; //Message when 'free'
    $thisDate = $_GET['date']; //date stamp
    $date = $_POST['date'];
    
    echo "<p align='center'><font size='5'>Bookings for ".$thisDate.'</font></p>';
    ?>
    <br />
    <p><br />
    
    </p>
    <script>
    function writeData(data)	{
    
    	var savedData = data;
    	return savedData;
    	
    }
    </script>
    <SCRIPT LANGUAGE="JavaScript">
    function replaceChars(entry) {
    out = "'"; // replace this
    add = ""; // with this
    temp = "" + entry; // temporary holder
    
    while (temp.indexOf(out)>-1) {
    pos= temp.indexOf(out);
    temp = "" + (temp.substring(0, pos) + add + 
    temp.substring((pos + out.length), temp.length));
    }
    return temp;
    }
    </script>
    <script language="javascript" type="text/javascript">
    <!-- 
    function ajaxFunction(period,room,spanId)	{
    
    	setInterval("getBookingData('"+period+"','"+room+"','"+spanId+"')",100)
    	
    }//Browser Support Code
    function getBookingData(period,room,spanId){
    	var ajaxRequest;  // The variable that makes Ajax possible!
    	
    	try{
    		// Opera 8.0+, Firefox, Safari
    		ajaxRequest = new XMLHttpRequest();
    	} catch (e){
    		// Internet Explorer Browsers
    		try{
    			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
    		} catch (e) {
    			try{
    				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
    			} catch (e){
    				// Something went wrong
    				alert("Error calling Ajax Function. Please make sure you are using a XML complaint browser.")
    				return false;
    			}
    		}
    	}
    	// Create a function that will receive data sent from the server
    	ajaxRequest.onreadystatechange = function(){
    		if(ajaxRequest.readyState == 4){
    			var divSend = document.getElementById(spanId)
    			divSend.innerHTML = ajaxRequest.responseText;
    		}
    	}
    	var getDate = "<?php echo $_GET['date']; ?>"
    	
    	var sendData = "?date="+getDate+"&period="+period+"&room="+room
    //	alert(sendData);
    	ajaxRequest.open("GET", "calendarProcess.php" + sendData, true);
    	ajaxRequest.send(null); 
    }
    //-->
    </script>
    <ul id="maintab" class="shadetabs">
    <li class="selected"><a href="#" rel="tcontent1">Period 1</a></li>
    <li><a href="#" rel="tcontent2">Period 2</a></li>
    <li><a href="#" rel="tcontent3">Period 3</a></li>
    <li><a href="#" rel="tcontent4">Period 4</a></li>
    <li><a href="#" rel="tcontent5">Period 5</a></li>
    <li><a href="#" rel="tcontent6">Period 6</a></li>
    </ul>
    
    <div class="tabcontentstyle">
    
    <div id="tcontent1" class="tabcontent">
    <span id="pd1_C1"></span><br />
    <span id="pd1_C2"></span><br />
    <span id="pd1_C3"></span><br />
    <span id="pd1_C4"></span><br />
    <span id="pd1_Lv1"></span><br />
    <span id="pd1_Lv3"></span><br />
    <span id="pd1_LibPC"></span><br />
    <span id="pd1_SeniorStudy"></span><br />
    
    <script>
    ajaxFunction('1','C1','pd1_C1')
    ajaxFunction('1','C2','pd1_C2')
    ajaxFunction('1','C3','pd1_C3')
    ajaxFunction('1','C4','pd1_C4')
    ajaxFunction('1','Lv1','pd1_Lv1')
    ajaxFunction('1','Lv3','pd1_Lv3')
    ajaxFunction('1','LibPC','pd1_LibPC')
    ajaxFunction('1','SeniorStudy','pd1_SeniorStudy')
    </script>
    </div>
    
    <div id="tcontent2" class="tabcontent">
    <span id="pd2_C1"></span><br />
    <span id="pd2_C2"></span><br />
    <span id="pd2_C3"></span><br />
    <span id="pd2_C4"></span><br />
    <span id="pd2_Lv1"></span><br />
    <span id="pd2_Lv3"></span><br />
    <span id="pd2_LibPC"></span><br />
    <span id="pd2_SeniorStudy"></span><br />
    
    <script>
    ajaxFunction('2','C1','pd2_C1')
    ajaxFunction('2','C2','pd2_C2')
    ajaxFunction('2','C3','pd2_C3')
    ajaxFunction('2','C4','pd2_C4')
    ajaxFunction('2','Lv1','pd2_Lv1')
    ajaxFunction('2','Lv3','pd2_Lv3')
    ajaxFunction('2','LibPC','pd2_LibPC')
    ajaxFunction('2','SeniorStudy','pd2_SeniorStudy')
    </script>
    </div>
    
    <div id="tcontent3" class="tabcontent">
    <span id="pd3_C1"></span><br />
    <span id="pd3_C2"></span><br />
    <span id="pd3_C3"></span><br />
    <span id="pd3_C4"></span><br />
    <span id="pd3_Lv1"></span><br />
    <span id="pd3_Lv3"></span><br />
    <span id="pd3_LibPC"></span><br />
    <span id="pd3_SeniorStudy"></span><br />
    
    <script>
    ajaxFunction('3','C1','pd3_C1')
    ajaxFunction('3','C2','pd3_C2')
    ajaxFunction('3','C3','pd3_C3')
    ajaxFunction('3','C4','pd3_C4')
    ajaxFunction('3','Lv1','pd3_Lv1')
    ajaxFunction('3','Lv3','pd3_Lv3')
    ajaxFunction('3','LibPC','pd3_LibPC')
    ajaxFunction('3','SeniorStudy','pd3_SeniorStudy')
    </script>
    </div>
    
    <div id="tcontent4" class="tabcontent">
    <span id="pd4_C1"></span><br />
    <span id="pd4_C2"></span><br />
    <span id="pd4_C3"></span><br />
    <span id="pd4_C4"></span><br />
    <span id="pd4_Lv1"></span><br />
    <span id="pd4_Lv3"></span><br />
    <span id="pd4_LibPC"></span><br />
    <span id="pd4_SeniorStudy"></span><br />
    
    <script>
    ajaxFunction('4','C1','pd4_C1')
    ajaxFunction('4','C2','pd4_C2')
    ajaxFunction('4','C3','pd4_C3')
    ajaxFunction('4','C4','pd4_C4')
    ajaxFunction('4','Lv1','pd4_Lv1')
    ajaxFunction('4','Lv3','pd4_Lv3')
    ajaxFunction('4','LibPC','pd4_LibPC')
    ajaxFunction('4','SeniorStudy','pd4_SeniorStudy')
    </script>
    <form></form>
    </div>
    <div id="tcontent5" class="tabcontent">
    <span id="pd5_C1"></span><br />
    <span id="pd5_C2"></span><br />
    <span id="pd5_C3"></span><br />
    <span id="pd5_C4"></span><br />
    <span id="pd5_Lv1"></span><br />
    <span id="pd5_Lv3"></span><br />
    <span id="pd5_LibPC"></span><br />
    <span id="pd5_SeniorStudy"></span><br />
    
    <script>
    ajaxFunction('5','C1','pd5_C1')
    ajaxFunction('5','C2','pd5_C2')
    ajaxFunction('5','C3','pd5_C3')
    ajaxFunction('5','C4','pd5_C4')
    ajaxFunction('5','Lv1','pd5_Lv1')
    ajaxFunction('5','Lv3','pd5_Lv3')
    ajaxFunction('5','LibPC','pd5_LibPC')
    ajaxFunction('5','SeniorStudy','pd5_SeniorStudy')
    </script>
    </div>
    <div id="tcontent6" class="tabcontent">
    <span id="pd6_C1"></span><br />
    <span id="pd6_C2"></span><br />
    <span id="pd6_C3"></span><br />
    <span id="pd6_C4"></span><br />
    <span id="pd6_Lv1"></span><br />
    <span id="pd6_Lv3"></span><br />
    <span id="pd6_LibPC"></span><br />
    <span id="pd6_SeniorStudy"></span><br />
    
    <script>
    ajaxFunction('6','C1','pd6_C1')
    ajaxFunction('6','C2','pd6_C2')
    ajaxFunction('6','C3','pd6_C3')
    ajaxFunction('6','C4','pd6_C4')
    ajaxFunction('6','Lv1','pd6_Lv1')
    ajaxFunction('6','Lv3','pd6_Lv3')
    ajaxFunction('6','LibPC','pd6_LibPC')
    ajaxFunction('6','SeniorStudy','pd6_SeniorStudy')
    </script>
    </div>
    </div>
    
    <script type="text/javascript">
    //Start Tab Content script for UL with id="maintab" Separate multiple ids each with a comma.
    initializetabcontent("maintab")
    </script>
    
    C1 : Computer Room <br />
    C2 : Conference/Video Room <br />
    C3 : Small Groups Room <br />
    C4 : Audio/Visual Room <br />
    Lv1: Level 1 - Library <br />
    LibPC : Library PC's <br />
    Lv3 : Level 3 - Library <br />
    SeniorStudy : Senior Study Area <br />
    </div>
    </body>
    
    </html>
    Don't know why. Maybe you guys can help me out. I think it's because of the ajax...

    Thanks,

    Peter
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  2. #2
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    I noticed that FireFox was running on 300MB memory usage as well when the page was running.
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    The 300MB is a pretty clear indication that that is a memory overload.
    Not sure why, though.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Take bits off until it no longer crashes. When you get to that point, the bit you just removed was the culprit
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    Can anyone guess what it is? I really don't have the time.
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  6. #6
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    Well, lets see it polls a server every 1/10 of a second. What do you expect to happen?

  7. #7
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    So do I need to have a dedicated server running?
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  8. #8
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    Here's my PHP page:

    PHP Code:
    <?php

    $thisDate 
    $_GET['date']; //date stamp
    $period $_GET['period']; //period
    $room $_GET['room']; //room
    $folderloc "data//"//data folder
    $msgFree $room." is free.";

    $editLink "editBooking.php?session=1&date=".$dateChosen."&period=".$periodChosen."&comment=".$comments."room=".$room;
    $bookLink "express.php?session=1&date=".$thisDate."&period=".$period."&room=".$room;

    $optionsEdit "    <font face='Verdana' size='1'>"."Options: "."<a href='".$editLink."'>Edit</a>";
    $optionsBook "    <font face='Verdana' size='1'>"."Options: "."<a href='".$bookLink."'>Book</a>";

    $bookingData "data//booking_".$thisDate."_".$period."_".$room.".txt"//file name


    if (@$fh fopen($bookingData'r'))    {

        
    $fh fopen($bookingData'r');
        
    $theData fread($fhfilesize($bookingData));
        echo 
    $theData;
        echo 
    $optionsEdit;
        
    fclose($fh);
        return 
    false;
    }

    else    {

        echo 
    $msgFree;
        echo 
    $optionsBook;
        return 
    false;
        
    }
    ?>
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  9. #9
    Join Date
    Oct 2006
    Posts
    75
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by blm126
    Well, lets see it polls a server every 1/10 of a second. What do you expect to happen?
    LMAO that'll do it

  10. #10
    Join Date
    Sep 2005
    Posts
    882
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    This script is harmful to the server(if too many people connect at once), and to the user. As such, I wouldn't recommend using it.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •