Window.Opener Creating A Refresh In Parent Window

David Henderson

Usenet Archive
Joined
Feb 20, 2003
Messages
8
Reaction score
0
Hi There...

I'm struggling with a problem:
I have a string (coming from a rich text editor) which contains a variety of span tags that need to be replaced with corresponding formatting tags.
e.g.

<span style="font-weight: bold;">line 2</span>

needs to become
<b>line 2</b>

So... with a single set of tags its simple. But then when you add in the underline and italic <span> tags it becomes a right mess - especially if you get nested tags which means you can't just replace the next </span> tag with the relevant formatting closing tag as it could be the closing tag from another nested tag.

e.g.

<span style="font-weight: bold;">bold and <span style="font-style:
italic;">italic <span style="text-decoration: underline;">Underlined bold & italic!! </span> just italic</span> now bold again </span>not bold<br />

Can anyone help?

Cheers

David Henderson
 

Thomas Gullen

Usenet Archive
Joined
Aug 28, 2004
Messages
2
Reaction score
0
Hi David,

Confused as to why this needs to be done, whats wrong with span tags? But, you would need to write your own function to acheive the desired results.

Read up on searching with regular expressions, and the replace function.

Tom
 

Roland Hall

Usenet Archive
Joined
Nov 4, 2003
Messages
964
Reaction score
0
"Thomas Gullen" wrote:
Confused as to why this needs to be done, whats wrong with span tags? But, you would need to write your own function to acheive the desired results.

Read up on searching with regular expressions, and the replace function.

...and how is this asp related?
 

Bob Lehmann

Usenet Archive
Joined
Jan 10, 2000
Messages
1,084
Reaction score
0
What, are you the off-topic OD today?

I would venture to say the question and answer given are more ASP-related than *your* answer. How was that ASP-related?

Bob Lehmann

"Roland Hall" <nobody@nowhere> wrote:

"Thomas Gullen" wrote:
Confused as to why this needs to be done, whats wrong with span tags? But, you would need to write your own function to acheive the desired results.

Read up on searching with regular expressions, and the replace
function.
...and how is this asp related?
http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
 

Steve Wark

Usenet Archive
Joined
Dec 12, 2003
Messages
5
Reaction score
0
I have created a ASP.NET application and created two forms within the application (Webform1.aspx & Webform2.aspx). On the first form I have placed a textbox (TextBox1) and a button, which when clicked opens the second form using the window.open. On the second form I have a textbox (TextBox1) and a button as well. When the second button is clicked it closes the second window with window.close. What I need to happen is a refresh to happen on the original form so that the value passed back from the second window is displayed in the textbox.

Webform1 Button Click Event
Private Sub LinkButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton1.Click

Dim popupScript As String = "<script language='javascript'>" & "window.open('webform2.aspx', 'CustomPopUp', " & "'width=600, height=400, menubar=no, resizable=no, top=200, left=200')" & "</script>"

Page.RegisterStartupScript("PopupScript", popupScript)

End Sub

Webform2 Button Click Event

Private Sub LinkButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton1.Click

Dim popupScript As String = "<script language='javascript'>" & "window.opener.document.forms(0).value=" & Chr(34) & TextBox1.Text & Chr(34) & ";window.close;window.opener.location.href = window.opener.location.href" & "</script>"

Page.RegisterStartupScript("PopupScript", popupScript)

End Sub

I have tried various options but none seem to work. Can anyone advise?

Cheers

Steve
 

Craig Deelsnyder

Usenet Archive
Joined
Nov 30, 1999
Messages
694
Reaction score
0
I have created a ASP.NET application and created two forms within the application (Webform1.aspx & Webform2.aspx). On the first form I have placed a textbox (TextBox1) and a button, which when clicked opens the second form using the window.open. On the second form I have a textbox (TextBox1) and a button as well. When the second button is clicked it closes the second window with window.close. What I need to happen is a refresh to happen on the original form so that the value passed back from the second window is displayed in the textbox.

Webform1 Button Click Event
Private Sub LinkButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton1.Click

Dim popupScript As String = "<script language='javascript'>" & "window.open('webform2.aspx', 'CustomPopUp', " & "'width=600, height=400, menubar=no, resizable=no, top=200, left=200')" & "</script>"

Page.RegisterStartupScript("PopupScript", popupScript)

End Sub

Webform2 Button Click Event

Private Sub LinkButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LinkButton1.Click

Dim popupScript As String = "<script language='javascript'>" & "window.opener.document.forms(0).value=" & Chr(34) & TextBox1.Text & Chr(34) & ";window.close;window.opener.location.href = window.opener.location.href" & "</script>"

Page.RegisterStartupScript("PopupScript", popupScript)

End Sub

I have tried various options but none seem to work. Can anyone advise?

Cheers

Steve

you're closing the second window before refreshing the opener; closing the window stops the script right there, so the next line never runs. Switch those around, .close is the last thing to do....

btw, why do you need a refresh immediately? You can put the value back into the opener's textbox and not need to force a refresh....just FYI
 

Steve Wark

Usenet Archive
Joined
Dec 12, 2003
Messages
5
Reaction score
0
I tired you suggestion but it did not work, can you point me to a code snippet ?

Steve
 

Roland Hall

Usenet Archive
Joined
Nov 4, 2003
Messages
964
Reaction score
0
"Bob Lehmann" wrote:
: What, are you the off-topic OD today?

Bob...

Show me the ASP related code in this post.

I would venture to say the question and answer given are more ASP-related than *your* answer. How was that ASP-related?

You're just too quick Bob however, I didn't provide an answer. I only asked a question. Your response is of no use. But, to answer your ridiculous question, I'll provide a ridiculous answer. My question at least had the word ASP included. Happy now?
 

David Henderson

Usenet Archive
Joined
Feb 20, 2003
Messages
8
Reaction score
0
: I'd attempted an asp solution and was looking for any ideas relating to : one... so seems fairly related to me ;-)

Sorry Dave...

I don't see anything related to ASP other than it's in this NG. You have only provided client-side code AFAICT. I only see inline styles with DOM related HTML.

Its OK Roland... I'll forgive you for not being a mind reader! I was originally going to post my attempt(s) but a) they didnt come close to working b) they were badly put together c) they were huge

So I decided for the sanity of everyone else not to. I was really just looking for some pointers towarrds a method... but I've sorted it out now anyway!

Sorry to be a pain in the ass!

David Henderson
 

Roland Hall

Usenet Archive
Joined
Nov 4, 2003
Messages
964
Reaction score
0
"David Henderson" wrote:

> : I'd attempted an asp solution and was looking for any ideas relating
to
> : one... so seems fairly related to me ;-)
>
> Sorry Dave...
>
> I don't see anything related to ASP other than it's in this NG. You
have
: > only provided client-side code AFAICT. I only see inline styles with DOM
> related HTML.
>

Its OK Roland... I'll forgive you for not being a mind reader! I was originally going to post my attempt(s) but a) they didnt come close to working b) they were badly put together c) they were huge

So I decided for the sanity of everyone else not to. I was really just looking for some pointers towarrds a method... but I've sorted it out now anyway!
...

Dave...

Clarification via a discussion does not make one a pain in the ass. If your code worked you wouldn't be asking for advice. You should probably never post all of your code but rather relevant code regarding your issue. If someone needs more info to help, they'll usually ask. I come here to gain knowledge and help where I can. Sometimes I'm successful. In this case, I needed more information because you're right, I'm not a mind reader but I play one on TV.

Glad you got a handle on your issue and thanks for responding.
 

bruce barker

Usenet Archive
Joined
Mar 29, 2002
Messages
5,092
Reaction score
0
you have a couple problems:

1) webform1 uses code that will not work with a popup blocker (say xp-sp2)
2) webform1 close itsself before doing anything
3) webform1 tries to update a textbox, but then forces a reload that will replace this value with tthe server version

-- bruce (sqlwork.com)

Steve Wark said:
I tired you suggestion but it did not work, can you point me to a code snippet ?

Steve

is
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,051
Messages
3,104,251
Members
248,135
Latest member
tobystanx

Latest Threads

Top