472,796 Members | 1,459 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,796 software developers and data experts.

whats wrong here

combo with PHP. what is wrong with the Javascript?

else
{
include("mysql.php");
$query1 = mysql_query("INSERT INTO gbook (naam, email, text) VALUES
('".$_POST['naam']."', '".$_POST['email']."', '".$_POST['text']."')");
?>
<script language="JavaScript">
<!--
opener.reload(true);
window.close();
//-->
</script>
<?
}
Jul 23 '05 #1
3 2335
Chris Geerdink wrote:
combo with PHP. what is wrong with the Javascript?
Umm, my first guess is "It doesn't work?". Seriously, whats wrong with
it depends on what its supposed to be doing, what its doing, and what
the PHP code is adding to the page. And also, what browser/UA you are
testing it with.

else
{
include("mysql.php");
$query1 = mysql_query("INSERT INTO gbook (naam, email, text) VALUES
('".$_POST['naam']."', '".$_POST['email']."', '".$_POST['text']."')");
?>
<script language="JavaScript">
<script type="text/javascript">

<!--
Not needed.
opener.reload(true);
window.opener.reload(true);
window.close();
The window.close() will only work in certain browsers, and only when the
page was opened via Javascript. Otherwise, you get a confirmation
telling you that script is trying to close the window.
//-->
Not needed.
</script>
<?
}

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
Jul 23 '05 #2
Randy Webb <hi************@aol.com> writes:

I agree with everything else, but there's just one thing I have to
comment on :)
opener.reload(true);


window.opener.reload(true);


That shouln't be necessary. Especially in the global scope, where this
code is executed, adding one level of indirection to the access of a
global variable adds nothing except overhead.
window.close();


The window.close() will only work in certain browsers, and only when
the page was opened via Javascript. Otherwise, you get a confirmation
telling you that script is trying to close the window.


But if "opener" is defined, then the page is most likely opened via
Javascript. If it isn't defined, then the previous line would error.

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleDOM.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 23 '05 #3
Lasse Reichstein Nielsen wrote:
Randy Webb <hi************@aol.com> writes:

I agree with everything else, but there's just one thing I have to
comment on :)

opener.reload(true);
window.opener.reload(true);

That shouln't be necessary. Especially in the global scope, where this
code is executed, adding one level of indirection to the access of a
global variable adds nothing except overhead.


True, it shouldn't be needed, but I have gotten in the habit lately of
making my references absolute just in case :-\
window.close();


The window.close() will only work in certain browsers, and only when
the page was opened via Javascript. Otherwise, you get a confirmation
telling you that script is trying to close the window.

But if "opener" is defined, then the page is most likely opened via
Javascript. If it isn't defined, then the previous line would error.


Yes, if opener is defined...... but opener doesn't have to be defined in
certain browsers to be able to close a window that script didn't open,
and it was that exception I was silently alluding to.

--
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/
Jul 23 '05 #4

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

Similar topics

9
by: iz0nlee | last post by:
can anybody tell me what is wrong here, I got this shockwave test from javascript in easy steps but it doesnt open the pages required <html> <head> <script type = "text/javascript"> if ( ...
1
by: Matthew Wilson | last post by:
I need to write a function crc(msg, len) that gets a char array of length len and then calculates the crc32 for the code. I don't understand what's going wrong in the code I have. It goes...
5
by: kernel.lover | last post by:
hello, I want to know if a fuction say malloc is declared as void *malloc() then whats the significance of void here. Does void * is used when function has the flexibility to return any type of...
3
by: mahsa | last post by:
Hi do you know whats wrong with this code? <asp:HyperLink id="HLink_Help" runat="server" NavigateUrl='<%# "javascript:window.open('comments.aspx?id=1,width=500,height=600, scrollBars=yes');"...
4
by: blah | last post by:
Hello everyone, Ive been trying to get my application to "click" on a button in another application using SendMessage, Ive gotten this far but Im not sure whats wrong with this code, here is the...
7
by: Mike Barnard | last post by:
It's a simple test... VERY SIMPLE. But... In an external stlyesheet some attributes don't show. With the same styles cut and pasted to the test internally it works as expected. Anyone tell...
1
by: Abubakar | last post by:
Hi, In my application, Some of my thread gets stuck somewhere. The vs2k5 debugging "Thread" window shows that stuck thread and I can I dentify it. In its Name column the following text is...
4
by: LoneHunter01 | last post by:
Basically, I just need a general direction on where to go for this. Yes, this is for a school project, though it's strictly an optional one (and I have tried many solutions, one in-depth). We've...
5
by: islayer | last post by:
can someone tell me what is wrong with the bold code? i am just learning perl. the program should create a perl file with a random name (5 letters, followed by a number), but the name is always just...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.