?
Solved

static and dynamic content on a page

Posted on 2005-02-26
10
Medium Priority
?
217 Views
Last Modified: 2010-04-06
My .shtml page has 2 sections: the top displays static html content, and below it, is the section for the random content display with  SSI.


Since I dont want to put the random content section of my page in a frame in order for the top section with fixed content (images,text, etc) to not flicker or blink when refreshing the page,

Can I use a table instead, so it refreshes this part (random content) only?


P.S. hope you understand what i'm trying to say, cause I'm chinese.


Viki


0
Comment
Question by:cayi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
10 Comments
 
LVL 13

Expert Comment

by:nurbek
ID: 13411896
try iframe

<iframe scrolling="no" width="468" height="60" frameborder="0" src="myfile.html"></iframe>
0
 
LVL 11

Expert Comment

by:JohnModig
ID: 13418543
I think I know what you mean with "top section with fixed content not flicker or blink when refreshing the page".

You could do it using javascript.
Your page will not flicker or blink.
The code will look something like this:

---------------------------------------
Put this somewhere within your <head> tags:
---------------------------------------

<script language="Javascript">
<!--
function changeContent(ssi)
{
var PrintDiv =  document.getElementById('dynamicContent');
var ContentDiv = document.getElementById(ssi);

PrintDiv.innerHTML = ContentDiv.innerHTML

}
//-->
</script>

---------------------------------------
Put this where you want to show your ssi content:
---------------------------------------

<div id="dynamicContent">
</div>

---------------------------------------
Put this where you want the links to change the ssi content:
---------------------------------------

<a href="#" onClick="changeContent('ssi1')">ssi1</a><br>
<a href="#" onClick="changeContent('ssi2')">ssi2</a><br>

---------------------------------------
Put this in the end of the page (these layers will not be visible, but we will need them to be able to load the ssi files):
---------------------------------------

<div id="ssi1" style="visibility: hidden;">
<!--#include file="ssi_file_1.htm" -->
</div>

<div id="ssi2" style="visibility: hidden;">
<!--#include file="ssi_file_2.htm" -->
</div>

---------------------------------------
Hope it helps, please keep me posted.

John
0
 

Author Comment

by:cayi
ID: 13425480
Hi John,

In my html code, Given that I already have a Javascript (Automatic target="_blank" Attribute For Links),  I added a target
attribute, so the link to change the ssi content would be the exception. the modified codes are below and my script as well at the end.

<a href="#" target="_top" onClick="changeContent('ssi1')">ssi1</a><br>

<div id="ssi1" style="visibility: hidden;">
<!--#exec cgi="/cgi-bin/MasterMerryGoRound.cgi"-->
</div>



The Script I have at the bottom of the page, above the </BODY> is:

<script type="text/javascript" language="JavaScript">
<!--
function NewWindowAllLinks()
{
   var numlinks = document.links.length - 1;
   for(var i = 0; i <= numlinks; i++)
   {
      document.links[i].target = '_blank';
   }
}
setTimeout('NewWindowAllLinks()',1000);
//-->
</script>


0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 11

Expert Comment

by:JohnModig
ID: 13427335
Well, is it working or not?
Oh, and btw, you should not have to go through all that just to change the target of the links.
------------------------------------------------
Just put this between your <head> tags:
------------------------------------------------
<base href="" target="_blank">
------------------------------------------------
By declaring a base target you are in affect telling the browser that all links contained within the document will be targeted to the same place, except for the ones that you specify with target attribute, like you did above.
0
 

Author Comment

by:cayi
ID: 13435530


I replace the script I had before, with <base href="" target="_blank">

As for The link to click to change the content, it seems to work for a one-time only, and for any subsequent clicks thereafter, my browser displays a warning yellow icon stating:

Line: 16
Char: 1
Error: object required
code: 0



Here's the coding that I have before the </body> tag on my page:

<a href="#" target="_top" onClick="changeContent('ssi1')">ssi1</a><br>
<p></p>
<div id="dynamicContent">

<!--#exec cgi="/cgi-bin/MasterMerryGoRound.cgi"-->

<div id="ssi1" style="visibility: hidden;">
<!--#exec cgi="/cgi-bin/MasterMerryGoRound.cgi"-->


P.S. Is the error due to repeating a line?
0
 
LVL 11

Expert Comment

by:JohnModig
ID: 13436854
Hmm... It works fine, for me.
On the other hand I do not know what your cgi script is doing so maybe it could be that.

Anyway, that message you got tells us that the problem is at line 16 in your code.
What is at line no 16?
0
 

Author Comment

by:cayi
ID: 13453989
>What is at line no 16?
I no longer have the error, it has been fixed somehow

I have another problem though, to better ilustrate it,
I've setup a demo page(it's an .html file instead of .shtml) at http://cayi.hostrocket.com

Please See that,
when the "ssi" link is clicked for the second time and  subsequently, nothing happens, that is, it won't load the next content in line for display, unless the browser window is refreshed
0
 
LVL 11

Accepted Solution

by:
JohnModig earned 400 total points
ID: 13463119
Hi again cayi, sorry for late reply.
The problem is not the javascript code. The problem is how the cgi script works.
The cgi needs to be reloaded in order to change the html content. So the second time you click the link the javascript copies the html code from the cgi which is then exactly the same code as the one thats already in the visible div. So, the javascript actually works (!) but to the eye, no changes are being made.
Get it?

If you don't it does not really matter, all you need to know is that the above javascript does not fit your purposes, unfortunately.
You have to reload the cgi script in order to make it generate new html content.
Since you do not want to use frames, you'll have to go with iframe instead.
The code should then be something like this:
------------------------------------------

<a href="javascript:parent.ssi1.location.reload()">ssi1</a><br></p>
<iframe name="ssi1" src="ssi_login.htm" width="500" height="200" scrolling="no" frameborder="0">
<!--#exec cgi="/cgi-bin/MasterMerryGoRound.cgi"-->
</iframe>´

------------------------------------------
Of course you have to play around with size and styling.
Let me know if it works for you.

John
0
 

Author Comment

by:cayi
ID: 13467900
Yes, I'll go with Iframe
thank you
0
 
LVL 11

Expert Comment

by:JohnModig
ID: 13468231
No problem m8 :)
Glad to help out.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Matthew
I am a very big proponent of technology compliance standards and strive to meet such criteria in all of my work. That includes my site, which is 100% XHTML 1.0 compliant as determined by the World Wide Web Consortium. https://www.matthewstevenkel…
Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question