/    Sign up×
Community /Pin to ProfileBookmark

Open Window diferent behavious in IE and Netscape 7.2

Can somebody please, try this code out and tell me how can I makje it working in both browsers. For now it works normaly in IE, but in Netscape it does not ?
I need a solution badly, because the form text element validation is crucial for me. Netscape simply doesn’t work the way I show here. Is the only way for validation would be to use alert() ?

If you simply copy/paste this code, will show exactly what I mean. Please, try it in IE and in Netscape7.2…


***

<HTML>
<HEAD>
<SCRIPT LANGUAGE=”JavaScript1.1″>
var newWindow = 0
function makeNewWindow(iz) {
if (!newWindow) {
newWindow = window.open(“”,””,”width=300, height=450″)
newWindow.document.write(“<HTML><HEAD><TITLE>Another SubWindow</TITLE></HEAD>”)
newWindow.document.write(“<BODY onBlur=’window.focus()’ bgcolor=’salmon’><H1>Salmon Window</H1>”)
newWindow.document.write(“<H1>”+iz+”</H1>”)
newWindow.document.write(“</BODY></HTML>”)
newWindow.document.close()
} else {
newWindow.close()
}
}

function testTest(iz) {
/* Some validation goes here and if needed start “makeNewWindow” */
makeNewWindow(iz)
}

function WinClose() {
if (newWindow) {
newWindow.close()
newWindow = 0
}
}

</SCRIPT>
</HEAD>
<BODY onFocus=”WinClose()”>
<FORM>
<INPUT TYPE=”text” VALUE=”1234″ NAME=”iznos” onBlur=”testTest(iznos.value)”>
<INPUT TYPE=”button” NAME=”newOne” VALUE=”Show new window” onClick=”testTest(iznos.value)”>
</FORM></BODY></HTML>


***

Thanks for any suggestion, I’m stacked…

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@A1ien51Jan 20.2005 — testTest(iznos.value)

should be

testTest(document.forms[0].iznos.value)

Eric
Copy linkTweet thisAlerts:
@codemakerauthorJan 20.2005 — Thanks for the answer.

Unfortunately this is not the problem and is not the solution for my problem either ?

The syntax

document.forms[0].iznos.value

is the same as

iznos.value

if it is issued from the line where we have INPUT clause. Therefore .....onBlur=testTest(iznos.value) //is the same as

.....onBlur=testTest(document.forms[0].iznos.value)

Anyway, the change you suggested didn't make any difference. I can still have window pops up from IE (for both events, onBlur and obClick) but in Netscape 7.2 I can only get window pops up if the event onClick is triggered by pressing the BUTTON, the text input onBlur, do not pops the window, it stays as the second window in the tray, therefore invisible for the client.

Again, thanks for your attention.

I stil desperately need help, otherwise I will have to change all my project files to issue standard, ugly alert() window if I want to inform the client about some problem... ?

Of course stil pissed-of because of such stupid diffreent JavaScript interpretation by IE and Netscape ?

Cheers

Boris
Copy linkTweet thisAlerts:
@A1ien51Jan 20.2005 — debug it, place alert statements in the function. Is it being called? is it going into the if statment or the else statement?

is the onFocus="WinClose()" causing the problem?

Those are things you need to look at...

Eric
Copy linkTweet thisAlerts:
@codemakerauthorJan 20.2005 — I did all possible kombinations ?

Internet Explorer works perfectly, for both text onBlur and for button onClick events

Netscape works normal only for button onClick event.

The problem with Netscape is that onBlur event triggers ALSO the new window creation, but it does not stay on top of current main window, it simply drops down on system try, indication that I have two windows created...

The easiest way to test is to copy the code into file and start it with IE and with Netscape, to see the difference.

Just to emphase, in the function "makeNewWindow" the statement onBlur='window.focus() is changed to onBlur=window.close() so this is the final version I am testing

There is no error in code, because IE works normaly. It is a mater of difference between IE and Netscape, in that how they interprete onBlur event from text input field ? My daubt is, if there is some work arround, to achieve the same logic and results, maybe with slightly different code.

Thank you for attention again

Boris
×

Success!

Help @codemaker spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.26,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...