PDA

View Full Version : Javascript menu to link to new window


philea_92
11-06-2003, 08:34 AM
Hi

I am trying to create a link from a menu bar that opens a registration form in a new window.

To do this I am using coding:

javasript:newwindow()

then define the function "new window" as follows


<script language="Javascript" type="text/javascript">
<!-- Hide script from old browsers

function newWindow() {
regWindow = window.open("register\signup.asp", "register", "width=330,height=250")
}

// End hiding script from old browsers -->
</script>

the problem being that it doesn't work!!
I have no clue as to why this is.

I am hoping it is a really simple thing to solve but who knows. If you have any ideas please let me know

piglet
11-06-2003, 10:33 AM
Hi,

Looks to me as if "register\signup.asp" should be "register/signup.asp"...

This will work:

<html><body>

<script type="text/javascript">
<!-- Hide script from old browsers
var regWindow
function newWindow() {
regWindow = window.open("register/signup.asp", "register", "width=330,height=250")
}
// End hiding script from old browsers -->
</script>

<a href="#" onclick="newWindow();return false">newwindow()</a>

</body>
</html>

philea_92
11-06-2003, 01:20 PM
Thanks very much for your reply


it works well, only thing is I wanted to be able to click from the menu register button and link it to the signup.asp file.

The register button was created using xaramenu thingy.

As you might have guesed I am only just starting out using scripting and its gonna give me an earloy deathv :)

piglet
11-06-2003, 03:19 PM
Hi,

I've not heard of the "xaramenu thingy" - but if you can post a link to the page we should be able to show you how to change it to link it to the signup.asp file...

God Zilla
11-06-2003, 04:50 PM
Why not just:


<html>
<head>
<script language="JavaScript" type="text/javascript">
<!--
function popup(page){
window.open(page,"popup","scrollbars=1,resizable=0,toolbar=0,width=330,height=250"); }
//-->
</script>
<title>My page</title>
</head>
<body>
<a href="javaScript:popup('register/signup.asp');">New window</a>
</body>
</html>


Is that what you are looking for...? :)

p.s. No space between "java" and "script". (I don´t know why this forum does that automatically??!)

philea_92
11-06-2003, 05:04 PM
Thanks to both your replies Piglet I have not got a web address so I attached all the relavent files to another thread "menusimple problem" meant to be a space. If you have the time to look I would be very grateful if not don't worry.

Thanks God Zilla but that would put a link in my page which I wouldn't want to be there:

<a href="java script:popup('register/signup.asp');">New window</a>

there is a button on my nav bar named register... In the link option of the programe (Xaramenu maker) it tells me that if I call the script using javascript:newwindow()
it will call the script to bring up the popup window.

philea_92
11-06-2003, 05:07 PM
I would have given up ages ago but I hate it when you get a simple bug thing which you can't solve..........You know what I mean?

=:O

God Zilla
11-06-2003, 05:42 PM
yep. I know what you mean. Sorry I misunderstood you. :rolleyes:

I´m gonna check out this "xaramenu" and see what you´re talking about. :)