Click to See Complete Forum and Search --> : Use link code for button in text link?
sanjuT
05-08-2003, 10:12 AM
I have this code for a button:
<input type="submit" name="Submit52222" value="Items" onClick ="NewWin=window.open('foodReception.html');return false;">
Is there a way to use this code for a text link instead of a form button?
I tried:
<a href= javascript:"NewWin=window.open('foodReception.html')";return false;>test</a>
But that didn't work.
I'm using Netscape 4.7x.
THANKS!!!!
jeffmott
05-08-2003, 10:15 AM
The reason it didn't work at all is because it's not quite the same. Take a close look at your quote marks. You should also put your script in an event handler so it will still work without scripting enabled.<a href="foodReception.html" onclick="NewWin = window.open('foodReception.html'); return false;">test</a>
sanjuT
05-08-2003, 10:24 AM
THANKS!!!!
It works!
Thanks again!!:)
You can also do this:
<a href="foodReception.html" onclick="NewWin=window.open(this.href); return false;">test</a>
sanjuT
05-08-2003, 10:32 AM
thanks jona!
sanjuT
05-08-2003, 02:34 PM
I have another related question:
using:
<a href="foodBreak1.html" onClick="NewWin=window.open(this.href); return false;">Items:</a>
am I able to set the size and position of the new window?
I know how to do it if i call a function, just wondering if i could do it by manipulating this piece of code.
THANKS!
<a href="foodBreak1.html" onClick="NewWin=window.open(this.href,'new_win','width=400,height=400,scrollbars=yes,menubar=yes'); return false;">Items:</a>
sanjuT
05-08-2003, 02:57 PM
when i use:
<a href="foodBreak1.html" onClick="NewWin=window.open(this.href,'new_win','width=400,height=400,scrollbars=ye
s,menubar=yes'); return false;">
the new page loads in the same window, and it is not adjusted for size.
A small error somewhere?
this. href
should be:
this.href
Notice the space you have.
sanjuT
05-08-2003, 03:08 PM
funny how that pasted, i checked my code and i do not have the space...weird..
Well, then the code should work (without the space). If it doesn't, you can just do window.open() and forget the variable, "NewWin" altogether.
sanjuT
05-08-2003, 03:16 PM
uhhh, i made a stupid mistake...when i was looking at my code, a place that i thought was a word wrap was actually a space..duhh!
i took out the NewWin anyways..it works for me now.
THANKS!!! u have been a great help these past few days!
:D