Hi all,

My page utilizes a few javascript files for my navigation bar and also a few other palces... My problems is this - I want to call to a page within the site as in the script below, but I wish it to be a separate WINDOW al-together. If I do what I have written now and the person hit;s the close button on the page I call to it closes the whole window - thus leaving my web page....

HELP!!!!

here's the script I need altered to have it open up a window on it's own.

document.write('</td></tr><tr></form><form><td>');
document.write('<input value="View Titles Slideshow" onClick="parent.location=\'slideshow.htm\'" onmouseover="this.className=\'buttonon\'" onmouseout="this.className=\'button\'" class="button" type="button"><br>');

THANKS SO MUCH!! :lol:

Are you just trying to open up a new window when something is pressed? Why not try the TARGET="_BLANK" method (insert this in your "A HREF" tag)?

Or the following method:

<script language="javascript">
<!--
 
function popupNewWindow(page) { 
window.open(page, "AddTask", "width=570,height=560,location=no,scrollbars=yes,menubars=yes");
}
 
-->
</script>
 
<a href="javascript:popupNewWindow('somepage.htm')">Click insert new</a>

Not sure if this is what you want.

Yes! Sorry for the f-up. Also, Dani, is there something you can do about the horrible parsing job the code tags do? It's putting unnecessary spacing between code. Look at the code I posted before, where it says "NewWindow" - there's a spacing there.

Ok, I dont wont to open another thread I'll ask here.
I have some stupid problem with reference to window.location!!! :-|

If 2 files bla.htm & bla.js(linked to first one ofcourse).

I wont to write a function witch loads another site when u press the onsubmit button. Im using window.location="mail.htm" in bla.js file but no results!! :sad:
So I have to make some kind of reference, but I dont know how, please help!

top.window.location="mail.html";

no?

Not working.
In bla.htm I have this submit button in form with user name & password I if they have the write one they are redirected to other site.If u know what I meen?
But I cant make a redirection in bla.js file. If I put the script in bla.htm file it works, but I dont wont to to this.

Does other javascript code work in the external file, within the page. (for example, have you tried making a function in the .js file, with nothing more than say, an alert with a message of test, and tried calling it with the page, just to see if the page is importing the external file?)

Agree. :D
Mybe some other sugsestion how can I acomplish redirection?
I'm doing this beacouse I have to se if username and password mach given.And if I include this script directly in bla.htm u could see in source code view both of them (un. and pwd)?!

You can do that anyway. If someone just views source, and then looks at the path to the external file, they can merely stick that in their browser as a URL, and open it or download it. Your Very best bet, is if you have server side access (for example, you can use ASP files, CGI files, PHP, or something along those lines). This way, the password is stored on the server, and never actually sent to the browser. With javascript, EVERYTHING gets sent to the browser, and is readable by it. There are TONS of free verification CGI's and ASP's, PHP's etc, etc. Also, should you need it to be custom built for some reason, let me know, and I can help with that also.

Yes I know all of this, but this is just for testing purposes, since I just installed Apache and have some sites copied (done by me) on server.Now I would like to make them accessible to few people who would say their opinion.I dont wont everyone out there to see it.
I'm just learning everything and I'm doing this step by step. :mrgreen:

That is the problem. I can program in Java & C too so I know for the compabilities of CGI & PHP.But as I told, everything is for testing purposes only.

Alright,

Then That seems to be the best way to go for what you are doing (sticking the password in an external JS file). If You need any other help, just let me know.

Actualy this is just what I'm tending to do. Validate the username and passwd in external file (whitch is working fine) and then redirect the person from login site to the site which has links to other sites. Here sits my problem.

*.htm file

<link rel="stylesheet" href="prva.css">
<script src="prva.js"></script>
</head>

<body>
<table  id="zacetnaTabela" width="300px" height="150px" align="center">
  <tr>
     <td>
	<table border="1" align="center">
	   <tr>
	      <td align="center">
		 <form name="myForm" onsubmit="return preveri(input.value,geslo.value);">
			UserName:<br>
			<input type="text" name="input"><br>
			Password:<br>
			<input type="password" name="geslo"><br>
			<input type="submit" value="Preveri!" size="15px">
		</form>
	      </td>
	   </tr>
	</table>
      </td>
   </tr>
</table>
</body>

prva.js file

function preveri(name,passwd){
	if((name=="test")&&(passwd=="test1")){
		alert("Pravilen vnos!");
		top.window.location = 'seznamStrani.htm';  //<---- PROBLEM
	}
	else{
		alert("Napano geslo in/ali uporabnisko ime!");
	}
}

And The: alert("Pravilen vnos!"); works fine right? It just doesn't redirect the site...

something else to consider... instead of using an "onsubmit" with a submit button, consider using a regular button, with an onclick event... that way you don't have to do a "return function();" You could call the function with the button, and then do a document.formname.submit(); in the javascript...... let me know your thoughts.

Also, Have you considered trying "parent.location" (or maybe it's parent.window.location)

Yeah! :cheesy: :cheesy:
It works with the usual button, just like u suggested! With parent.window.location <-- :cheesy:

Thanks A LOT!

can you help me ?
how this code is decode ?
what about this code effect?

<SCRIPT LANGUAGE="JavaScript">
<!--
Code0 = "%3CSCRIPT%20LANGUAGE%3D%22JavaScript%22%3E%0D%0A%3C%21--%0D%0ACode0%20%3D%20%22%253CSCRIPT%2520LANGUAGE%253D%2522JavaScript%2522%253E%250D%250A%253C%2521--%250D%250ACode0%2520%253D%2520%2522%25253Chtml%25253E%25250D%25250A%25253Chead%25253E%25250D%25250A%25253Ctitle%25253ECyber-Warrior.Org%25253C/title%25253E%25253C/head%25253E%25250D%25250A%25253Cb%25253E%2525u015Eifre%252520%25253D%2525205ta2552945255%25253C/b%25253E%25250D%25250A%25253C/html%25253E%25250D%25250A%2522%253B%250D%250Adocument.write%2528unescape%2528Code0%2529%2529%253B%250D%250A//--%253E%250D%250A%253C/SCRIPT%253E%22%3B%0D%0Adocument.write%28unescape%28Code0%29%29%3B%0D%0A//--%3E%0D%0A%3C/SCRIPT%3E";
document.write(unescape(Code0));
//-->
</SCRIPT>

Thanks...

This article has been dead for over six months. Start a new discussion instead.