/    Sign up×
Community /Pin to ProfileBookmark

Conflict with animated gif

I have just added the following script to a page, and it makes all the animated gifs freeze every time it is called. I think this indicates I need ‘return false’ and ‘return true’ statements in there, but I don’t know where to put them. There is another Javascript (from an online library) on the page which runs successfully and causes me no problems.

Thanks for your help.

The Script:

function acceptTerms(URL)
{
var r=confirm(“I have read and understood the website Copyright Notice.”)
if (r==true)
{
window.location=(URL)
}
else
{
alert(“No dice.”)
}
}

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@mrhooFeb 08.2007 — confirms, alerts and prompts all take the focus from the window, and suspend any running processes, as if you pressed the stop button.

Get the confirmation from a form input on the page instead of the confirm.
Copy linkTweet thisAlerts:
@DashiellauthorFeb 09.2007 — Thanks for replying. I'm not sure I understand what you mean though. Currently the script is called by an <input> tag in the body, based on an example I saw in w3schools.com:

<input type="image" onclick="acceptTerms('http://www.myhost/music.mp3')" src="animated.gif" alt="Blah" />

If I put the <input> in a <form> tag, then it runs fine and the confirm boxes don't freeze the gifs. However, the URL doesn't seem to be passed to the script as the 'File Download' box doesn't open.

I'm probably making some obvious mistake, but I'd appreciate it if you could point it out.

Thanks again.
×

Success!

Help @Dashiell 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 6.2,
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: @meenaratha,
tipped: article
amount: 1000 SATS,

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

tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,
)...