Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

javascript on IE 6

Status
Not open for further replies.

robertd18

Technical User
Jan 14, 2003
32
US
hi i have a redirection script that works on IE5 but not on IE6 here is the code:

if(confirm("Thanks! Click Cancel to report"))
{
parent.location='}
else
{
parent.location='}
 
hmm it doesnt work on my IE6 but that doesnt mean it doesnt work on all IE6

var enable = true;
function fUnload() {
if (enable) {
if(confirm.....

if they click a button the fUnload doesnt run,
but if they refresh the page it runs
 
Ok... but how are you calling the code? Is it called via the button's onclick attribute? The body's onunload attribute? The form's onsubmit attribute?

The code is fine... if it runs on IE6 it runs on IE6... assuming of course, that you haven't switched JavaScript off in your browser. The answer to your problem probably lies in how the code is being executed (or not executed).
 
if a button is clicked, the code is not called, or
the onclick event is false, but if the page is refreshed
without the button click its true
 
OK, remeber that I'm only trying to help, but what code are you using to trigger this function?

For example, does your button code look like:
<input type=&quot;button&quot; onclick=&quot;runSomeFunction()&quot;>

Does your body tag look like:
<body onunload=&quot;runSomeFunction()&quot;>

If you post the code you are using then it will be much easier to see where you've gone wrong.
 
<body onunload=&quot;function&quot;> thanks for being so helpful :)
 
here is the actual code

<SCRIPT>
var enable = true;
function fUnload() {
if (enable) {
if(confirm(&quot;Thanks.....! Click Cancel to.....&quot;))
{
parent.location='}
else
{
parent.location='http.....';
}
}

<body onUnload=&quot;fUnload()&quot;>
}
 
Ok, from the looks of things there could be a couple of problems:
[tt]
<SCRIPT>
var enable = true;
function fUnload() {
if (enable) {
if(confirm(&quot;Thanks.....! Click Cancel to.....&quot;)) {
[ignore]parent.location='[/ignore]
}
else {
[ignore]parent.location='http.....';[/ignore]
}
}
} //You make sure all the braces match up
</script> <!-- You MUST close the script tag before any more html -->
</head> <!-- you should also close the head tag before starting the body -->
<body onUnload=&quot;fUnload()&quot;>
...[/tt]


Now that we have that more-or-less sorted... what is this 'button' that you keep referring to? If you just put a button on the page it won't do anything, there needs to be some code behind it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top