Advertisement

04.05.2001 at 03:49PM PDT, ID: 20102419
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.2

changing content of frame on user event

Asked by ibo in JavaScript

Tags: , ,

i have a scroller (i got somewhere)
and here is the code. i omitted the javascript functions :
---------------

<DIV id="divUpControl" style="top: 60; left: 40">
<a href="#" onMouseOver="MM_swapImage('Image5','','images/prevx.gif',1); PerformScroll(-7)" onMouseOut="MM_swapImgRestore(); CeaseScroll()">
<IMG height=20 src="images/prev.gif" width=34 border=0 name="Image5"></A></div>

<DIV id="divDownControl" style="top: 340; left: 40">
<a href="#" onMouseOver="MM_swapImage('Image6','','images/nextx.gif',1); PerformScroll(7)" onMouseOut="MM_swapImgRestore(); CeaseScroll()">
<IMG height=22 src="images/next.gif" width=34 border=0 name="Image6"></A></DIV>

<div id="divContainer" style="left: 40; width: 400; top: 100; height: 220; clip: rect(0 400 230 0)">
  <div id="divContent">
     
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World
   Hello World

             
  </div>
</div

-------------

now what i want is is i have a button somewhere in the page, and if i click on it, the content of "divContent" will change to whatever text i predefined. how do i do that? any snippets u guys keeping on your treasure chest? thx in advance!

ps. i already have a similar code like that (replaces the text, just like a normal frame). but it uses the <iframe> (inline frame) tag which i dont know if the scroller script is compatible with it.

it goers something like :

<LAYER id=content HEIGHT="220" WIDTH="398" TOP="118" LEFT="19"
ONLOAD="hookupEvents(this)"><IFRAME
style="LEFT: 19px; WIDTH: 398px; TOP: 118px; HEIGHT: 220px" name=content
src="home.htm" width=219 scrolling=no></IFRAME></LAYER>      


and has the code :

<SCRIPT>
  function doClick(ev) {
    if (ev.target.href) {
      var layer = document.layers[ev.target.target]
      if (layer) {
        layer.src = ev.target.href
        return false
      }
    }
    this.routeEvent(ev)
    return true
  }

  function hookupEvents(el) {
    el.captureEvents(Event.CLICK)
    el.onclick = doClick
  }

  var ieDHTML = document.all !=null
  var nsDHTML = document.layers

  function checkFrames() {
    var iframes = window.frames
    var numFrames = iframes.length
    for (var i=0; i < numFrames; i++) {
      var f = iframes[i]
      if ((f.document.readyState=="complete") && (f.document.cached==null)) {
        f.document.body.style.border = "none"
        var elFrame = document.all[f.name].tags("IFRAME")[0]
        elFrame.style.height = f.document.body.scrollHeight
        f.document.cached = true
      }
    }
    setTimeout("checkFrames()",100)
  }

  if (nsDHTML) {
    window.captureEvents(Event.CLICK)
    window.onclick = doClick
  }

  if (ieDHTML)
    checkFrames()

</SCRIPT>

Start Free Trial
 
Loading Advertisement...
 
[+][-]04.05.2001 at 04:07PM PDT, ID: 5991448

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 14-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.05.2001 at 04:14PM PDT, ID: 5991464

View this solution now by starting your 14-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: JavaScript
Tags: content, iframe, changing
Sign Up Now!
Solution Provided By: tomkyn
Participating Experts: 2
Solution Grade: A
 
 
 
Loading Advertisement...
20081112-EE-VQP-43