Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help inserting Java into code...

Status
Not open for further replies.

jmalge

MIS
Aug 3, 2012
7
US
Hi all. I'm going to start by saying I am an extreme novice when it comes to code, especially Java. I have a client support screen that shows call statistics as well as SolarWinds maps. This isn't something I built, but something I basically walked into as I'm rather new to the company. Anyway, here's my issue.

The page needs refreshed throughout the day. I have determined that IE is eating up memory causing the page to stop functioning. Below is the code...


<html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "<head>
<script type="text/javascript" src="jquery-1.3.2.min.js"></script>
<script type="text/javascript">
var iframeSrc = new Array;
//iframeSrc[0] = "//iframeSrc[1] = "//iframeSrc[2] = "//iframeSrc[3] = "iframeSrc[0] = "iframeSrc[1] = "iframeSrc[2] = "iframeSrc[3] = "//Look into using NetworkMap.aspx instead of MapView.aspx...
var intervalVar;
var interval = 30; // seconds between iframe switching
var currentSrc = 0;
var lastPage = iframeSrc.length - 1;
var playing = false;


function switchPage() {
var randomnumber=Math.floor(Math.random()*100000);
$('#myIframe').fadeTo(1000,0,function() {
currentSrc++;
if (currentSrc > lastPage) currentSrc = 0;
document.getElementById("myIframe").src = iframeSrc[currentSrc] + "&amp;random=" + randomnumber;
}).fadeTo(1000,1);
}


function slideshow() {
if (playing) {
playing = false;
clearInterval(intervalVar);
}
else {
playing = true;
intervalVar = setInterval(switchPage, interval * 1000);

}
}
function loadpage() {
document.getElementById("myIframe").src = iframeSrc[0];
slideshow();
}
</script>
<title>Support Page Viewer</title>
</head>
<body leftmargin="0" topmargin="0" onload="loadpage()">

<iframe id="myIframe" src="" width="75%" scrolling="NO" frameborder="0" height="75%" ></iframe>
<iframe id="callsframe" src=" width="25%" scrolling="NO" height="75%"></iframe>
<iframe id="agentsframe" src=" width="100%" height="25%" scrolling="no" marginheigh="0" marginwidth="0"></iframe>

</body>
</html>


Vacunita on another forum suggested that I do the following...

Wow, clearly nobody has bothered to actually read what the JS code is doing.

The Meta refresh isn't going to do anything useful in this scenario. The Js is not only refreshing the iframe, its also changing the src and the src URL by moving a counter along and adding a random parameter to it which I'm going to assume makes the src modify its contents in some fashion.

With that said, I think the option here would be to have the refresh kill the interval every so often to see if that releases memory.

CODE
var now = new Date();
var timeKeeper = now.getHour();

function switchPage() {
var now2 = new Date();
var newHour = now.getHour();
if(newHour > timekeeper)
{
playing=true;
slideshow();
timekeeper = newHour;
slideshow();
var randomnumber=Math.floor(Math.random()*100000);
...

This should kill off the interval running about every hour, hopefully release memory, and start it off again, as per the slideshow function.



Here's my issue. I have no idea where to put this in the code to make it work. My final question was asked where in the code to put this new code but I got no response. So I'm coming to the Java folks to see if they can help. I'm completely lost here and simply want to get this page working again. Vacunita's approach looks like it's going to work, I just don't know where to implement it. I greatly appreciate any help you can offer.
 
I don't see anything in your code that even looks like Java.

And this is not the Java forum, so even if you had Java there, you would not likely get an answer here.

mmerlinn


Poor people do not hire employees. If you soak the rich, who are you going to work for?

"We've found by experience that people who are careless and sloppy writers are usually also careless and sloppy at thinking and coding. Answering questions for careless and sloppy thinkers is not rewarding." - Eric Raymond
 
The original thread is at >> thread215-1689928

Chris.

Indifference will be the downfall of mankind, but who cares?
Time flies like an arrow, however, fruit flies like a banana.
Webmaster Forum
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top