473,573 Members | 3,145 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with Opera and JavaScript

I've been trying to make this simple script compatible across various
browsers. It works for IE 6.0 and NS 7 but doesnt work with Opera (I
have version 7.11). This is what is supposed to happen: when the user
clicks a button in the main window, a dialog window pops up. In the
dialog the user enters a university to search for. When the string is
submitted, the dialog then shows all the matches found in the
database. The user picks one and clicks the Submit button. The Submit
button's code is as follows:

<INPUT type="button" value="Submit"
onclick="javasc ript:refreshPar entWizard(windo w,
parent.opener.l ocation);">

It calls refreshParentWi zard(), whose sole purpose is to edit the
query string arguments so that the main page will save itself when a
university is returned. Its code is:

function refreshParentWi zard(window, location) {

// find the querystring (if it exists)
iQueryString = location.href.i ndexOf('?');

if (iQueryString > -1) {
location.href=l ocation.href.su bstring(0, iQueryString) +
"?action=quicks ave&screen=prev ious_education& ";
}
else {
location.href=l ocation +
"action=quicksa ve&screen=previ ous_education&" ;
}

document.forms[0].submit();

self.close();

return true;

}

After the button is clicked, the function is called which submits the
form and closes the window (as seen in the code above). Then the main
window is refreshed displaying the University the user picked in a
field. The problem is Opera will refresh the main page but the
selected university does not show up. I have tried many different ways
to do it but none will work. I have checked to make sure that the form
is passing the right query string arguments when submitted and it is
passing the same arguments in every browser. I have also checked the
docs for Opera to see if it supports the functions and it appears that
it does. I was having problems getting the script to work in NS but I
got it to work by changing the Submit button type from "submit" to
"button" and simply calling form.submit(). I am pretty lost so if
anyone could help me, it would be greatly appreciated.

Thanks,
Shaun
Jul 20 '05 #1
6 2707


Shaun Fleming wrote:
I've been trying to make this simple script compatible across various
browsers. It works for IE 6.0 and NS 7 but doesnt work with Opera (I
have version 7.11). This is what is supposed to happen: when the user
clicks a button in the main window, a dialog window pops up. In the
dialog the user enters a university to search for. When the string is
submitted, the dialog then shows all the matches found in the
database. The user picks one and clicks the Submit button. The Submit
button's code is as follows:

<INPUT type="button" value="Submit"
onclick="javasc ript:refreshPar entWizard(windo w,
parent.opener.l ocation);">

It calls refreshParentWi zard(), whose sole purpose is to edit the
query string arguments so that the main page will save itself when a
university is returned. Its code is:

function refreshParentWi zard(window, location) {

// find the querystring (if it exists)
iQueryString = location.href.i ndexOf('?');

if (iQueryString > -1) {
location.href=l ocation.href.su bstring(0, iQueryString) +
"?action=quicks ave&screen=prev ious_education& ";
}
else {
location.href=l ocation +
"action=quicksa ve&screen=previ ous_education&" ;
}

document.forms[0].submit();

self.close();

return true;

}

After the button is clicked, the function is called which submits the
form and closes the window (as seen in the code above). Then the main
window is refreshed displaying the University the user picked in a
field. The problem is Opera will refresh the main page but the
selected university does not show up. I have tried many different ways
to do it but none will work. I have checked to make sure that the form
is passing the right query string arguments when submitted and it is
passing the same arguments in every browser. I have also checked the
docs for Opera to see if it supports the functions and it appears that
it does. I was having problems getting the script to work in NS but I
got it to work by changing the Submit button type from "submit" to
"button" and simply calling form.submit(). I am pretty lost so if
anyone could help me, it would be greatly appreciated.


Are you getting any errors in the Opera JavaScript console?

Although you have provided a long description anyone trying to
understand what could go wrong will much easier be able to do that if
you provide a URL to a test page where the problem happens. I understand
that it might be a problem if server side code is involved that is not
on a public server but maybe a test case with static pages allows to
demonstrate the problem.
--

Martin Honnen
http://JavaScript.FAQTs.com/

Jul 20 '05 #2

Upgrade to IE ... lol ;) ... jk
On 21 Jan 2004 08:55:30 -0800, sp***@mail.umd. edu (Shaun Fleming)
wrote:
I've been trying to make this simple script compatible across various
browsers. It works for IE 6.0 and NS 7 but doesnt work with Opera (I
have version 7.11). This is what is supposed to happen: when the user
clicks a button in the main window, a dialog window pops up. In the
dialog the user enters a university to search for. When the string is
submitted, the dialog then shows all the matches found in the
database. The user picks one and clicks the Submit button. The Submit
button's code is as follows:

<INPUT type="button" value="Submit"
onclick="javas cript:refreshPa rentWizard(wind ow,
parent.opener. location);">

It calls refreshParentWi zard(), whose sole purpose is to edit the
query string arguments so that the main page will save itself when a
university is returned. Its code is:

function refreshParentWi zard(window, location) {

// find the querystring (if it exists)
iQueryString = location.href.i ndexOf('?');

if (iQueryString > -1) {
location.href=l ocation.href.su bstring(0, iQueryString) +
"?action=quick save&screen=pre vious_education &";
}
else {
location.href=l ocation +
"action=quicks ave&screen=prev ious_education& ";
}

document.forms[0].submit();

self.close();

return true;

}

After the button is clicked, the function is called which submits the
form and closes the window (as seen in the code above). Then the main
window is refreshed displaying the University the user picked in a
field. The problem is Opera will refresh the main page but the
selected university does not show up. I have tried many different ways
to do it but none will work. I have checked to make sure that the form
is passing the right query string arguments when submitted and it is
passing the same arguments in every browser. I have also checked the
docs for Opera to see if it supports the functions and it appears that
it does. I was having problems getting the script to work in NS but I
got it to work by changing the Submit button type from "submit" to
"button" and simply calling form.submit(). I am pretty lost so if
anyone could help me, it would be greatly appreciated.

Thanks,
Shaun


Brynn
www.coolpier.com

I participate in the group to help give examples of code.
I do not guarantee the effects of any code posted.
Test all code before use!
Jul 20 '05 #3
sp***@mail.umd. edu (Shaun Fleming) wrote in message news:<e9******* *************** ****@posting.go ogle.com>...

if (iQueryString > -1) {
location.href=l ocation.href.su bstring(0, iQueryString) +
"?action=quicks ave&screen=prev ious_education& ";
}
else {
location.href=l ocation +
"action=quicksa ve&screen=previ ous_education&" ;
}


don't you want "?action=.. ." here?
Jul 20 '05 #4
ri******@cs.nor thwestern.edu (Chris Riesbeck) wrote in message news:<b7******* *************** ****@posting.go ogle.com>...
sp***@mail.umd. edu (Shaun Fleming) wrote in message news:<e9******* *************** ****@posting.go ogle.com>...

if (iQueryString > -1) {
location.href=l ocation.href.su bstring(0, iQueryString) +
"?action=quicks ave&screen=prev ious_education& ";
}
else {
location.href=l ocation +
"action=quicksa ve&screen=previ ous_education&" ;
}


don't you want "?action=.. ." here?


Yea it is "?action=.. ." in the actual code. I mustve somehow deleted
the question mark when pasting the code. Sorry.

Shaun
Jul 20 '05 #5
Martin Honnen <ma*******@yaho o.de> wrote in message news:<40******* *@olaf.komtel.n et>...
Shaun Fleming wrote:
I've been trying to make this simple script compatible across various
browsers. It works for IE 6.0 and NS 7 but doesnt work with Opera (I
have version 7.11). This is what is supposed to happen: when the user
clicks a button in the main window, a dialog window pops up. In the
dialog the user enters a university to search for. When the string is
submitted, the dialog then shows all the matches found in the
database. The user picks one and clicks the Submit button. The Submit
button's code is as follows:

<INPUT type="button" value="Submit"
onclick="javasc ript:refreshPar entWizard(windo w,
parent.opener.l ocation);">

It calls refreshParentWi zard(), whose sole purpose is to edit the
query string arguments so that the main page will save itself when a
university is returned. Its code is:

function refreshParentWi zard(window, location) {

// find the querystring (if it exists)
iQueryString = location.href.i ndexOf('?');

if (iQueryString > -1) {
location.href=l ocation.href.su bstring(0, iQueryString) +
"?action=quicks ave&screen=prev ious_education& ";
}
else {
location.href=l ocation +
"action=quicksa ve&screen=previ ous_education&" ;
}

document.forms[0].submit();

self.close();

return true;

}

After the button is clicked, the function is called which submits the
form and closes the window (as seen in the code above). Then the main
window is refreshed displaying the University the user picked in a
field. The problem is Opera will refresh the main page but the
selected university does not show up. I have tried many different ways
to do it but none will work. I have checked to make sure that the form
is passing the right query string arguments when submitted and it is
passing the same arguments in every browser. I have also checked the
docs for Opera to see if it supports the functions and it appears that
it does. I was having problems getting the script to work in NS but I
got it to work by changing the Submit button type from "submit" to
"button" and simply calling form.submit(). I am pretty lost so if
anyone could help me, it would be greatly appreciated.


Are you getting any errors in the Opera JavaScript console?

Although you have provided a long description anyone trying to
understand what could go wrong will much easier be able to do that if
you provide a URL to a test page where the problem happens. I understand
that it might be a problem if server side code is involved that is not
on a public server but maybe a test case with static pages allows to
demonstrate the problem.


Sorry for the delay in response. I had to ask my boss if it was ok to
post the site. And No I am not getting any errors in the Javascript
console. I am currently looking at another thread where another guy
had a similar problem as me with Opera 7 (I think the thread is called
"Javascript and Opera 7" or something along those lines). The link to
the site is <a href="https://was-1.umd.edu/admissions/Entry.jsp">http s://was-1.umd.edu/admissions/Entry.jsp</a>
but u will need to fill out some registration stuff bc this web app is
currently being used for graduate applications. Once you've filled out
everything and returned the confirmation email, the problem is when
you click the Previous Education tab and click the magnifying glass
next to the "College/University" text field. Another window will then
pop up where you will have to enter a search string for a college
name. Once you submit the search a list of matches will come up.
Select one and click submit. The dialog window will close and the main
page will be refreshed but instead of having the text field next to
the magnifying glass, you should see a bullet and the college you
picked. However, this doesnt work in Opera (the form does not seem to
be submitted for some reason). If you want to see how it should work,
do the steps above in IE or Netscape 7. And again, any suggestions
would be greatly appreciated.

Thanks,
Shaun

P.S. You might not want to actually submit the entire application
because this site is a prod site and all applications do get looked at
by the University.
Jul 20 '05 #6
Hi,
I solved my problem yesterday. After looking at many threads in this
newsgroup, I was getting the impression that many other people were
having a problem submitting a form in Opera via the form.sumbit()
function. I experimented with the code and realized that Opera does
not submit the form when the form.submit() function is called.
However, there is no error in the JavaScript console. I tried changing
the input type of the Submit button from "button" to "submit" (I was
using an ordinary button that, when clicked, called a function to
submit the form, refresh the main page, and close the current child
window in which the form was located. I did this because I was having
some problems using an input of type "submit" in Netscape.) Upon
changing the type of the button to "submit", the form was properly
submitted but I could not close the child window which it was in
because it would either close the window before the form was submitted
or it would submit the form and load a white screen before the close()
function could be called. The solution to this (at least the only one
I could think of that would work in my particular situation) is to put
"onunload="java script:window.c lose()" in the body tag. Even though it
seems redundant, in that one would figure that this would be called
when the window was being closed and as a result be in the process of
unloading, it works because this is called after the form has been
submitted but before the next page (the white screen resulting from
the submission) was loaded. After testing it with under various
circumstances (i.e. Opera's spoofing ability and other variations),
the modification seems to work in all cases. Thanks to all who took
the time to read and try to help me out.

Shaun Fleming
Jul 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
3573
by: tony kulik | last post by:
This code works fine in ie and opera but not at all in Mozilla. Anybody got a clue as to how to get it right? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <script language="JavaScript" type="text/javascript"> function show(that) { if (box.style.visibility=='hidden') { that.style.visibility = 'visible'}; }
3
9421
by: Marcus Bjorke | last post by:
I use a print link that causes a problem with Opera 7. The link looks like this <a href="javascript:parent.frames.mainFrame.print()">Print this page</a> I also used <a href="javascript:print()">Print this page</a> and it also worked with most browsers. I realize that it only works if you have Microsoft Windows versions for PC but that is...
5
1747
by: Paul Fi | last post by:
Can someone help me here because this is really killing me! the problem is, i have this javascript code in my aspx page that i want it to work on almost all browsers, especially opera and safari : function resize(){ displayFrm = document.getElementById("ifrmDisplay"); innerDoc = (displayFrame.contentDocument) ?displayFrm.contentDocument...
4
2419
by: VR | last post by:
First, greetings to everyone :) I'm doing a university seminar & I've encountered a problem. I have a gallery with thumbnails linked on pictures. What I want is popup to be opened with dimensions of linked picture after clicking on a thumbnail. I found javascript which is compatible with IE, Firefox & Opera but I can't get it to work. All...
1
3086
by: Paul Fi | last post by:
can some one help me here coz this is really killing me! the problem is, i have this javascript code in my aspx page that i want it to work on almost all browsers, especially opera and safari : function resize(){ displayFrm = document.getElementById("ifrmDisplay"); innerDoc = (displayFrame.contentDocument) ?displayFrm.contentDocument :...
34
3816
by: Simon Wigzell | last post by:
document...focus() will scroll the form to move the specified text field into view on everything I have tried it with except Safari on the MAC. The form doesn't move. Any work around? Thanks.
1
2132
by: Alexandre Lahure | last post by:
Hi all, The facts : a rich text editing applet, a HTML/Javascript toolbar and Liveconnect to make them communicate alltogether. - Java to JS communication (for updating the state of the toolbar - text align, style, color) is OK - JS to Java communication (for changing text align, style, color) doesn't work as expected : * Under Firefox,...
2
3141
by: sorobor | last post by:
dear sir .. i am using cakephp freamwork ..By the way i m begener in php and javascript .. My probs r bellow I made a javascript calender ..there is a close button ..when i press close button then the calender gone actually i want if i click outside off the calender then it should me removed ..How kan i do this ... Pls inform me as early...
15
2002
by: dhtml | last post by:
Title says it. If I use a for in loop on an HTML collection, I get length twice. <!DOCTYPE HTML> <html lang="en"> <head> <title>length twice</title> </head> <body> <form action="javascript:;" id="form1">
0
7686
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7773
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8061
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5289
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3730
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3731
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2197
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1297
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1038
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.