[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 255
  • Last Modified:

Back to "preloading" html again...

After a quick search of the net for preloading text on a page, I came across this topic: http://www.experts-exchange.com/Web/Web_Languages/HTML/Q_20499229.html

I am currently in a small team designing a webpage for a school camp. We are having difficulties in working out the coding to make a script that writes text on our page when a menu image is clicked.  Our page uses divisions instead of frames, and if possible we would like to keep it this way.  Basically, I am looking for how to make this htmlgoodies script:

<SCRIPT LANGUAGE="JavaScript">
function openindex()
      {
OpenWindow=window.open("", "newwin");
OpenWindow.document.write("<HTML>")
OpenWindow.document.write("<TITLE>Title Goes Here</TITLE>")
OpenWindow.document.write("<BODY BGCOLOR=pink>")
OpenWindow.document.write("<h1>Hello!</h1>")
OpenWindow.document.write("This text will appear in the window!")
OpenWindow.document.write("</BODY>")
OpenWindow.document.write("</HTML>")
     }
</SCRIPT>

create a new division/layer as opposed to a new window.  I suppose this is more of a javascript topic, but the script is there, we're just not sure how to make it open a new division (with text/code) instead of a window.  Htmlgoodies.com states they have seen this done, but unfortunately does not supply the code.  Considering the last person to ask this seemed happy with that code, does anyone here know how we could do this?  Obviously it is possible.

It also does away with loading times and will make the site look more professional.

Thank you in advance.
0
inferno_x
Asked:
inferno_x
  • 2
  • 2
  • 2
1 Solution
 
russellshomeCommented:
A little demo:

<script>
function getObject(id) {
     if (document.all) {
          return document.all(id);
     } else if (document.getElementById) {
          return document.getElementById(id);
     }
     return null;
}

function openindex() {
     var html = "<div style='background-color:pink'>"
     html += "<h1>Hello!</h1>"
     html += "This text will appear in the div!"
     html += "</div>"
     return html;
}

var innerHTML;

function doTest(objButton,id) {
     if (objButton.value=="Show") {
          innerHTML = getObject(id).innerHTML;
          getObject(id).innerHTML=openindex();
          objButton.value="Hide";    
     } else {
          getObject(id).innerHTML = innerHTML;
          objButton.value="Show";    
     }
}
</script>

<table>
     <tr>
          <td id="test1" style="width:200px;height:100px;" valign="top">Change This Text</td>
          <td id="test2" style="width:200px;height:100px;" valign="top">No Change to This Text</td>
     </tr>
</table>

<p>

<form>
     <input type="button" value="Show" onClick="doTest(this,'test1');" style="width:100px">
</form>
0
 
COBOLdinosaurCommented:
This question has been classified abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.

<note>
Unless it is clear to me that the question has been answered I will recommend delete.  It is possible that a Grade less than A will be given if no expert makes a case for an A grade. It is assumed that any participant not responding to this request is no longer interested in its final disposition.
</note>

If the user does not know how to close the question, the options are here:
http://www.experts-exchange.com/help/closing.jsp


Cd&

0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
dorwardCommented:
recommendation: Points to me for pointing to a detailed and easy to follow tutorial (well, I found it easy to follow and JavaScript and I have never gotten on well).
0
 
russellshomeCommented:
Recommendation: Points to me for giving an excellent and easy to follow demo.
0
 
COBOLdinosaurCommented:
It is time to clean this abandoned question up.

I am putting it on a clean up list for CS.

<recommendation>
points to dorward

</recommendation>

If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.

Cd&

0

Featured Post

The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

  • 2
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now