PDA

View Full Version : Drop-Down Document Viewer II



GeeJay
07-11-2010, 07:45 PM
1) Script Title: Can this be changed?
2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex3/dropdownview2.htm

3) Describe problem: I just found a script written by DynamicDrive guys, and it is exactly what I have been looking for a long time. Implementing it is a joy. Using it is a pleasure. Little problem: I can ONLY call URLs from outside my website.

Can this be changed so the script can call .html files "from within" my own web site? Please, do not ignore me. I need this jewel.

azoomer
07-11-2010, 08:13 PM
Hi GeeJay. I just tried the script and it works fine on my site viewing a page on the same domain. I used an absolute path http://.......
It is a nifty feature, but I wonder if it is legal to put other sites in an iframe like this. What do you think ?

GeeJay
07-11-2010, 11:53 PM
I appreciate your response, Azoomer. I exclusively use http:// URLs in the code. External URLs work, but the moment I point the code to .html docs within my web site, it does not work. In addition, at the very left bottom corner of the browser I can read "Done with errors." - [IE 8]

The reason why I posted is because I do not know. I need the answer of a knowledgeable guy at DynamicDrive, hopefully. So, I cannot answer the question "What do you think?"

Maybe, one of the guys who put together this wonderful piece can have a look at the code I am using. It is located at http://www.fountain-of-wisdom.com/index-2.html

Thanks very much one more time.

azoomer
07-12-2010, 12:20 AM
I suggest you change this back to "external" as it is in the original code

document.getElementById("internal").src=inputurl
else if (document.all&&displaymode==0)
document.all.internal.src=inputurl

Before it was referring to the id="external" which is the id of the iframe. There is no id called internal on your page, hence the error.

GeeJay
07-12-2010, 01:17 AM
Thanks so much for not giving up on me, Azoomer. I mean it.

Changing the "internal" to "external" was my assumption that it MAY have to do with .html documents being within the domain. After unsuccessfully attempting the change, I immediately reverted the code back to the original code which is the one you sent me.

I just cannot understand. Such a heck of an idea has to be abandoned. I concluded that there must be a reason why the developers provide the code with external URLs and they mention nothing about calling up .html docs within the same domain the code is being used on.

Well... C'st La Vie as the French say. An entire Sunday without seeing the sun went down the drain just for the fun of it. Back to good, old... and reliable... HTML. I remain very thankful to the only guy that showed up to lend a hand. If you were a girl, I will kiss you. Thanks so much good guy !

azoomer
07-12-2010, 01:21 AM
glad i'm not a girl
And by the way, i can't truly understand the logic in what you are writing in your last comment, just be sure to use the original script. That works. ( if it aint broken.....)

GeeJay
07-12-2010, 01:57 AM
The "kiss a girl" statement means that I am so thankful to you that I would be willing to show my appreciation with an act of affection. The last statement means that using the code as provided works with URLs pointing to "external URLs." When the code is used to point to "internal URLs" it does not work.

A way to verify my statement is the browser itself saying "Done with error on page" even when I copied the entire code as provided. I wouldn't have spent an entire Sunday if the developers of the code would have said something like "This code is meant only for "external URLs" as the sample provided shows."

I keep the kiss, and I remain thankful to you for your good will and intent in this unsolved matter.

azoomer
07-12-2010, 07:09 AM
GeeJay. Don't give up. the script actually works for the purpose you need. To show you what i mean I have made a demo page that you can see HERE (http://azoomer.com/iframeviewer.html).
As you can see the framed pages are all on the same domain, as you would call internal. But the point I have been trying to make is that you should not put to much meaning in the words internal/ external. As long as you don't change the word external in the original script it will work, even when referring to a page on your own domain.

Another example of the script working with pages on the same domain can be seen HERE (http://www.dynamicdrive.com/dynamicindex3/dropdownview.htm), it is the first edition of the script on DD.

The code I pasted into post #4 was not meant as something for you to use, it was a copy of the code you were already using on your page. I was trying to illustrate what the error was.

I suggest you try again.

This is the original code from dynamic drive. (Drop-down Document Viewer II)

<!--CHANGE LINKS BELOW TO YOUR OWN-->
<a href="javascript:jumpto('http://www.cnn.com')">CNN.com</a> |
<a href="javascript:jumpto('http://www.msnbc.com')">MSNBC</a> |
<a href="javascript:jumpto('http://www.abcnews.com')">ABC News</a> |
<a href="javascript:jumpto('http://news.bbc.co.uk')">BBC UK News</a>

<script language="javascript">
<!--

//Drop-down Document Viewer II- Dynamic Drive (www.dynamicdrive.com)
//For full source code, 100's more DHTML scripts, and TOS,
//visit http://www.dynamicdrive.com

//Specify display mode (0 or 1)
//0 causes document to be displayed in an inline frame, while 1 in a new browser window
var displaymode=0
//if displaymode=0, configure inline frame attributes (ie: dimensions, intial document shown
var iframecode='<iframe id="external" style="width:95%;height:400px" src="http://www.yahoo.com"></iframe>'

/////NO NEED TO EDIT BELOW HERE////////////

if (displaymode==0)
document.write(iframecode)

function jumpto(inputurl){
if (document.getElementById&&displaymode==0)
document.getElementById("external").src=inputurl
else if (document.all&&displaymode==0)
document.all.external.src=inputurl
else{
if (!window.win2||win2.closed)
win2=window.open(inputurl)
//else if win2 already exists
else{
win2.location=inputurl
win2.focus()
}
}
}
//-->
</script>
If you use that and ONLY edit what I have highlighted in blue color, and nothing else, I am sure you will get it working quickly.