/    Sign up×
Community /Pin to ProfileBookmark

Can I put Javascript Close Window in PHP?

I already went through this problem about a month ago, but apparently couldn’t figure out how to work it.

I want Close Window to be a link that closes the window.

[code=php]
echo( “<CENTER>” );

echo( “<FONT SIZE=2 COLOR=333333 FACE=Geneva, Arial, Helvetica, sans-serif>” );

echo( “Thank you for your submission to CONCEPTS2MKT<BR>&nbsp;<BR>We will review your inquiry and contact you with the requested information.<BR>&nbsp;<BR><BR>CLOSE WINDOW” );

echo( “</FONT>” );

echo( “</CENTER>” );
[/code]

I tried putting Javascript close window, but didn’t do it: I was getting error message in the echo. Maybe I need to add something else in the body to make the Java script work (I don’t really know Java script, nor php; I just copy & paste code).

[code=php]
<a href=”javascript:window.close();”>CLOSE WINDOW</a>
[/code]

[code=php]
echo( “Thank you for your submission to CONCEPTS2MKT<BR>&nbsp;<BR>We will review your inquiry and contact you with the requested information.<BR>&nbsp;<BR><BR><a href=”javascript:window.close();”>CLOSE WINDOW</a>” );
[/code]

Another problem I have is when you click on Submit button on:
[URL]http://www.concepts2mkt.com/interest.htm[/URL]
the form does not reset on submit. You’ll get the:
Thank you for your submission to CONCEPTS2MKT window.
And if you close that window, you’ll see that the form had not reset.
Feel free to try it.

What can I do to fix tese two problems? Thanks.

james

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@Daniel_TAug 25.2004 — For the window closing problem, it is because you have tried to put double quotes within other double quotes. Escape the double quotes with backslashes () like so:[code=php]echo( "Thank you for your submission to CONCEPTS2MKT<BR>&nbsp;<BR>We will review your inquiry and contact you with the requested information.<BR>&nbsp;<BR><BR><a href="javascript:window.close();">CLOSE WINDOW</a>" );[/code][b]EDIT[/b]

Also, don't use the JavaScript protocol. Use the onclick event handler instead:[code=php]echo( "Thank you for your submission to CONCEPTS2MKT<BR>&nbsp;<BR>We will review your inquiry and contact you with the requested information.<BR>&nbsp;<BR><BR><a href="#" onclick="window.close(); return false">CLOSE WINDOW</a>" );[/code]
Copy linkTweet thisAlerts:
@jamesx521authorAug 25.2004 — Thanks for the tip Close Window works now

[CODE]<a href="#" onclick="window.close(); return false">CLOSE WINDOW</a>[/CODE]
×

Success!

Help @jamesx521 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.17,
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,
)...