PDA

View Full Version : Question about resizing, removing scrollbar...



hktvb2001
09-29-2005, 04:06 AM
Hello,

Well, I have a problem and hope every PRO Javascript can help me to solve this out.

On my site, I want the page below:
http://www.vm-source.com/vm-music/myWimpy.php

I want the window to resize itself when you enter (which it's already done), but I would like that people cannot resize the window, cannot scrolling the page and I want to disable the Address Bar and all other Toolbar...

I don't want to use Javascript URL (popup, I mean)

All I want: People enter to the page, the page will stretch, and there will be no tollbar, scrollbar... Only the TitleBar is allowed..

It is possible?

jscheuer1
09-29-2005, 05:52 AM
Can't be done without a pop-up except the bit about the scrollbar. The pop-up would have to be coded on the page that contains a link to this page. I'm not sure why you don't want a pop-up, it is actually superior (to resizing onload) for this if launched directly from a link, because browsers that do not allow javascript to resize an open window will allow initial opening of a window to a specific size.

To disable the scrollbars:

<body style="overflow:hidden;">

Why exactly don't you want a pop-up?

hktvb2001
09-29-2005, 02:49 PM
OK.. I will tell you why...

I have a forum just like this one.. VBulletin..

I have try to insert an javascript link on the forum, but it doesn't work..
Well, I have enable the HTML, but it doesn't work too..

That it why I don't want popup.. Or can you find a solution that we can insert an javalink on a such forum, in a post...

Suppose: On my site, I tell people to "Click Here" in order to view a pic..and I want to popup it.. but with the javascript, it doesn't work..:(

Can I use this:

<script language="JavaScript1.2">
<!--

//Open offsite links in new window option- By Jessica Hammer
//Heavily modified by Dynamic Drive
//Visit http://www.dynamicdrive.com for this script

//1)Enter domains to be EXCLUDED from opening in new window:
var excludedomains=["dynamicdrive.com", "javascriptkit.com"]

//2)Automatically open offsite links in new window? (1=yes, 0 will render a checkbox for manual selection)
var auto=1

var excludedomains=excludedomains.join("|")
rexcludedomains=new RegExp(excludedomains, "i")

if (!auto)
document.write('<form name="targetmain"><input type="checkbox" name="targetnew" checked onClick="dynamiclink()">Open off-site links in new window</form>')

function dynamiclink(){

if (auto||(!auto&&document.targetmain.targetnew.checked)){
for (i=0; i<=(document.links.length-1); i++) {
if (document.links[i].hostname.search(rexcludedomains)==-1&&document.links[i].href.indexOf("http:")!=-1)
document.links[i].target="_blank"
}
}
else
for (i=0; i<=(document.links.length-1); i++) {
if (document.links[i].hostname.indexOf(mydomain)==-1)
document.links[i].target=""
}
}

if (auto)
window.onload=dynamiclink

// -->
</script>

<p align="center"><font face="Arial" size="-2">Free DHTML scripts provided by<br>
<a href="http://www.dynamicdrive.com">Dynamic Drive</a></font></p>

But if you can add more option, so the new window won't have the toolbar and scrollbar...

jscheuer1
09-29-2005, 04:07 PM
Hmm, the forums resist javascript links for a good reason but if this is your own forum you can try:


function dynamiclink(){

if (auto||(!auto&&document.targetmain.targetnew.checked)){
for (i=0; i<=(document.links.length-1); i++) {
if (document.links[i].hostname.search(rexcludedomains)==-1&&document.links[i].href.indexOf("http:")!=-1)
document.links[i].onclick=function(){
window.open(this.href,'','width=495,height=190,resizable=0')
return false;
}
}
else
for (i=0; i<=(document.links.length-1); i++) {
if (document.links[i].hostname.indexOf(mydomain)==-1)
document.links[i].target=""
}
}

hktvb2001
09-29-2005, 05:02 PM
THANK YOU VERY MUCH!!! IT WORKS....

hktvb2001
09-29-2005, 05:19 PM
OUPS!! I forgot something..

The popup that appears is located in my site.. but the script open a new window on an offlink site.. What do I have to do, if I want a html file on a folder to be open in a new window?

my site: www.vm-source.com
the file that I want to be opened: www.vm-source.com/index.php

If I use this script, then it won't open in a new window, because the index.php is locate is www.vm-source.com

How do I make on the script that it let the index.php open, but all link in my site.. www.vm-source.com stay as it..mean it don't open in a new window..

jscheuer1
09-29-2005, 09:17 PM
Well, I'm not sure I understand the specific objective here. Also, I cannot 'play' with this one because it involves a forum which I don't have at my disposal. However, it seems that you just need a way of identifying those links that you wish to apply this effect to. So, how many links do you want to have open in a new window? What, if anything, is special about them as far as their url's go? It doesn't have to be the domain, as you suggest, it could be a folder but you haven't supplied a folder name so I'm not sure this is what you have in mind. Let's use a folder though if possible. This would mean putting all onsite pages that you want to have receive this special treatment in a special folder say, new_wins, for example:

www.vm-source.com/new_wins/or we could use the existing directory:

www.vm-source.com/vm-music/Then in the script change:

if (document.links[i].hostname.search(rexcludedomains)==-1&&document.links[i].href.indexOf("http:")!=-1)to:

if (document.links[i].indexOf('vm-music')!==-1&&document.links[i].href.indexOf("http:")==-1)This will work for files in the vm-music folder if the forum does not automatically add the the absolute path to links, if it does, you can go with:

if (document.links[i].indexOf('vm-music')!==-1&&document.links[i].href.indexOf("vm-source.com")!==-1)

hktvb2001
09-29-2005, 10:07 PM
OK.. Now it doesn't work..

Here's the script I insert in my page:

<script language="JavaScript1.2">
<!--
function dynamiclink(){
if (auto||(!auto&&document.targetmain.targetnew.checked)){
for (i=0; i<=(document.links.length-1); i++) {
if (document.links[i].indexOf('vm-music')!==-1&&document.links[i].href.indexOf("vm-source.com")!==-1)
document.links[i].onclick=function(){
window.open(this.href,'','width=495,height=190,resizable=0')
return false;
}
}
}
else
for (i=0; i<=(document.links.length-1); i++) {
if (document.links[i].hostname.indexOf(mydomain)==-1)
document.links[i].target=""
}
}

if (auto)
window.onload=dynamiclink
// -->
</script>


Does that mean that all file in the folder "vm-music" will be opened in a new window with the no-resize option? and all file in vm-source.com will not open in new window?

Well, it doesn't work.. The script which work before was this:



<script language="JavaScript1.2">
<!--

//Open offsite links in new window option- By Jessica Hammer
//Heavily modified by Dynamic Drive
//Visit http://www.dynamicdrive.com for this script

//1)Enter domains to be EXCLUDED from opening in new window:
var excludedomains=["vm-source.com"]

//2)Automatically open offsite links in new window? (1=yes, 0 will render a checkbox for manual selection)
var auto=1

var excludedomains=excludedomains.join("|")
rexcludedomains=new RegExp(excludedomains, "i")

if (!auto)
document.write('<form name="targetmain"><input type="checkbox" name="targetnew" checked onClick="dynamiclink()">Open off-site links in new window</form>')

function dynamiclink(){

if (auto||(!auto&&document.targetmain.targetnew.checked)){
for (i=0; i<=(document.links.length-1); i++) {
if (document.links[i].hostname.search(rexcludedomains)==-1&&document.links[i].href.indexOf("http:")!=-1)
document.links[i].onclick=function(){
window.open(this.href,'','width=495,height=190,resizable=0')
return false;
}
}
}
else
for (i=0; i<=(document.links.length-1); i++) {
if (document.links[i].hostname.indexOf(mydomain)==-1)
document.links[i].target=""
}
}

if (auto)
window.onload=dynamiclink


// -->
</script>


Now, can you give me the whole new edit script which work for my request?

jscheuer1
09-30-2005, 03:17 AM
I left out the red part:

if (document.links[i].href.indexOf('vm-music')!==-1&&document.links[i].href.indexOf("vm-source.com")!==-1)That's the trouble with not being able to play with it on the page. Anyways, the script (if I now have the above conditional correct) should be able to be cut down to:

<script type="text/javascript">
<!--
function dynamiclink(){
for (var i=0; i<(document.links.length); i++)
if (document.links[i].href.indexOf('vm-source.com/vm-music')!==-1)
document.links[i].onclick=function(){
window.open(this.href,'','width=495,height=190,resizable=0')
return false;
}
}

window.onload=dynamiclink;
// -->
</script>

hktvb2001
09-30-2005, 07:31 AM
Well,

Thank you many and many TIMES... You are so great.. Thanks for your help.. It was so helpfull.. Thanks again...

Also, If I want to have more than vm-music folder, what do I have to put in?
Is that right?


<script type="text/javascript">
<!--
function dynamiclink(){
for (var i=0; i<(document.links.length); i++)
if (document.links[i].href.indexOf('vm-source.com/vm-music','vm-source.com/anotherfolder')!==-1)
document.links[i].onclick=function(){
window.open(this.href,'','width=495,height=190,resizable=0')
return false;
}
}

window.onload=dynamiclink;
// -->
</script>


Also, maybe you gonna think that I'm StuP*d... But can I remove the STATUS bar also?? hi hi.. it is? status=no or status=0??

THANKS AGAIN..

jscheuer1
09-30-2005, 09:35 AM
For the first part, no - not exactly, it would be like:

if (document.links[i].href.indexOf('vm-source.com/vm-music')!==-1||document.links[i].href.indexOf('vm-source.com/anotherfolder')!==-1)If you want to include a number of folders we could return to the original code somewhat. The part that allows a list of url's to test for. Or, you could put everything in one folder, with subfolders allowed, like the new_win folder I mentioned. Then you could have:

vm-source.com/new_win/vm-source

and

vm-source.com/new_win/anotherfolder

and all you would have to test for would be:

if (document.links[i].href.indexOf('vm-source.com/new_win')!==-1)The second question, about the status bar. As far as I know it cannot be done. I believe IE6 considers that a security violation. It will allow you to remove the status bar locally but, not live. FF will allow it to be removed live but, only if the user's browser is so configured (it is an option). All of the chrome that is now missing from our new window is missing because we don't mention it in the window.open() command. That is the same as setting it to no or to 0, all of which mean 'don't use it'. I haven't exhaustively tested this but, that's how it is, to the best of my knowledge.

hktvb2001
09-30-2005, 01:49 PM
THANK YOU VERY MUCH! AGAIN and AGAIN.. Your help is very appreciate..