PDA

View Full Version : JS issues



VistaBoy
16-09-2008, 12:23 PM
Any one know how to Force some one to go to anther page using JS

i got this but it just hangs.



function logout( )
{
var r=confirm("Are you sure you want to logout?");
if (r==true)
{
document.write('<meta http-equiv="refresh" content="0;URL=logout.php" />');
}
else
{
}
}

Agnostic Bear
16-09-2008, 12:30 PM
window.location = 'www.microsoft.com';

Source
16-09-2008, 12:31 PM
Pretty simple if I remember correctly.




window.location="http://www.pagehere.com";

<!-- which would give you -->

function logout( ){

var r=confirm("Are you sure you want to logout?");

if (r==true) {
window.location="logout.php";
}else{

}

}

VistaBoy
16-09-2008, 12:38 PM
Okay thats worked to a point but ye it seem to tack me back to the page i was last on :S

EDIT i am using

<li><a onclick="logout();" href="#" >Logout</a></li>

Agnostic Bear
16-09-2008, 03:40 PM
Try:

<a onclick="logout();" style="cursor: hand; cursor: pointer;">

Agnostic Bear
16-09-2008, 03:58 PM
Uhh, a more logical solution would be this:

<a onclick="logout(); return false;" href="#">

Jack!
16-09-2008, 05:14 PM
I been raedinh up on JS and one solution was use a coundon time when it reaches 1 it redirects to antother page

Hypertext
17-09-2008, 11:28 PM
Yeah. Jewbear got it... lol at the cursor stuff. But if you don't use return false; some browswers will try and hit it up.

VistaBoy
17-09-2008, 11:56 PM
Uhh, a more logical solution would be this:

<a onclick="logout(); return false;" href="#">

Thank you that got it!

VistaBoy
19-09-2008, 05:52 AM
Okay i got a all new issue

http://laydesk.com if you go there the links at the bot jobs and contact us you click them they open a box but i can not get them to work in IE6 :S

code:


function toggle( id ) {

if( document.getElementById( id ).style.display == 'block' )
{
document.getElementById( 'none' ).className='none';
document.getElementById( id ).style.display = 'none';
}
else if( document.getElementById( id ).style.display == 'none' )
{
document.getElementById( id ).style.display = 'block';
document.getElementById( 'none' ).className='yes';
}

}

Agnostic Bear
19-09-2008, 06:49 AM
It's useless to try and support IE6 unless you know what you're doing, just make it functional for them but just don't use javascript.

VistaBoy
19-09-2008, 08:36 AM
It's useless to try and support IE6 unless you know what you're doing, just make it functional for them but just don't use javascript.

I could do that (do not know how to make it so it will use the js for IE7,FF etc and a file for IE6) but i would like to have it work in IE6.. so can any one help?

Want to hide these adverts? Register an account for free!