By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,814 Members | 1,671 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,814 IT Pros & Developers. It's quick & easy.

Popup window not working properly in IE6

P: n/a
The following code is not working properly in IE6 but it does work for
mozilla firefox.

I am trying to open a new popup window without affecting the frame from
"where" it came. But what happens when I click on the link is that the
popup window is displayed correctly but the frame then changes to my
default.htm. It is supposed to stay the same

here is my code

Response.Write "<td><a href=" & """" & """" & " onclick=" & """" &
"javascript:window.open('desc.asp?msg=" & tempdesc & "','" & rownum &
"','toolbar=no,location=no,directories=no,status=n o,menubar=no,scrollbars=yes,resizable=no,width=600 ,height=600,left=300,top=300')"
& """" & ">" & left(tempdesc,50) & "....</a></td>"

Sep 26 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
What if you try # instead of an empty string for the href attribute ?
Or if you cancel the event ?

I believe that IE6 goes to / because of the empty string for href...

--
Patrice

"Terren" <pa**@legalperfect.co.za> a écrit dans le message de
news:11*********************@g14g2000cwa.googlegro ups.com...
The following code is not working properly in IE6 but it does work for
mozilla firefox.

I am trying to open a new popup window without affecting the frame from
"where" it came. But what happens when I click on the link is that the
popup window is displayed correctly but the frame then changes to my
default.htm. It is supposed to stay the same

here is my code

Response.Write "<td><a href=" & """" & """" & " onclick=" & """" &
"javascript:window.open('desc.asp?msg=" & tempdesc & "','" & rownum &
"','toolbar=no,location=no,directories=no,status=n o,menubar=no,scrollbars=ye
s,resizable=no,width=600,height=600,left=300,top=3 00')" & """" & ">" & left(tempdesc,50) & "....</a></td>"

Sep 26 '05 #2

P: n/a
Thanks that worked. It is always the simple things

*** Sent via Developersdex http://www.developersdex.com ***
Sep 26 '05 #3

P: n/a
Patrice wrote:
What if you try # instead of an empty string for the href
attribute ? Or if you cancel the event ?


Just an aside, but this is one of my pet peeves. If the user has scrolled
the page at all, clicking on such a link will not merely fire the onclick
handler, it will also return him to the top of the page.

The proper solution here is to either *stop* using <a href>...

<input type="button" onclick="dosomething()" ...>
<span onclick="doSomething"> ... </span>

....or at least cancel the click event:

<a href="" onclick="doSomething();return false"> ... </a>


--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Sep 26 '05 #4

P: n/a
Yes, you are right but I had to use href because I have a table full of
these. Basically it is a table with abbreviated descriptions that
"link" to the full description in the popup window. So it wouldn't look
to good if I had 100's of buttons and I don't know how readable it
would be as well because the abbreviation is 50 characters long

I think I will cancel the event though.

Thanks for all your guys help, I am well on my way to becoming a
mediocore web programmer

Sep 27 '05 #5

P: n/a
Terren wrote:
Yes, you are right but I had to use href because I have a
table full of these. Basically it is a table with abbreviated
descriptions that "link" to the full description in the popup
window. So it wouldn't look to good if I had 100's of buttons
and I don't know how readable it would be as well because the
abbreviation is 50 characters long...


Well...button is but one possibility. A small graphic can be just as useful.

Nevertheless, there is another approach, and it's probably a better one. You
can *use* the HREF attribute:

<a href="desc.asp?msg="<%=tempdesc%>"
target="win<%=rownum%>"
onclick="window.open('','win<%=rownum%>',...)">

The key here is matching the TARGET name to a window name. No need to pass
the URL via script, and if scripting should err, it will *still* open in a
new window.

Incidentally, there is no need to list the window attributes you do not
want, nor to use yes/no. This is sufficient:

window.open(...,...,"width=600,height=600,left=300 ,top=300,scrollbars")

A little reading helps:

"When the sFeatures parameter is specified, the features that
are not defined in the parameter are disabled. Therefore, when
using the sFeatures parameter, it is necessary to enable all
the features that are to be included in the new window. If the
sFeatures parameter is not specified, the window features
maintain their default values. In addition to enabling a
feature by setting it to a specific value, simply listing the
feature name also enables that feature for the new window."

http://msdn.microsoft.com/workshop/a...ods/open_0.asp
One last thing -- you seem to be passing the entire description in your
querystring. What happens if that description includes line breaks, quotes,
or other characters that might break your URL?

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Sep 27 '05 #6

P: n/a
I can see you are very wise, you forsore some problems that I did
experience, i.e with quotes,breaks. I setup another asp page with some
general functions that would replace the breaks with <br> and the quote
and other characters with alternatives but then I thought that this is
crazy because I can't cater for
every possible problem character. So what I am going to do now is pass
the primary key for the relavant record and then I will get the
description straight from the database in the popup window.

Sep 28 '05 #7

P: n/a
Terren wrote:
...this is crazy because I can't cater for every possible
problem character. So what I am going to do now is pass the
primary key for the relavant record and then I will get the
description straight from the database in the popup window.


That was the solution I was hoping you would see.

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms. Please do not contact
me directly or ask me to contact you directly for assistance. If your
question is worth asking, it's worth posting.
Sep 28 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.