SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question href / onclick... not working in IE6

    Hi, does anyone know why the following doesn't work in IE6, or how I could get it to work?

    Code HTML4Strict:
    <a href="index.php?month=6&year=2007" onclick="getCalendar('6', '2007'); return false;">Prev</a>

    I want the href to only be used if javascript is disabled... but IE6 uses it anyway

    Where as IE7 and firefox work fine...

    Any ideas?

    Thanks,

  2. #2
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,629
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Put return false into the getCalendar() function?
    Ian Anderson
    www.siteguru.co.uk

  3. #3
    SitePoint Enthusiast
    Join Date
    Oct 2007
    Location
    Sydney, Australia
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If there is a javascript error in your getcalendar function it could cause this behaviour, but the code you have provided doesnt appear to give me any errors (i made a dummy getcalendar function).
    Kind Regards,
    Steve
    http://www.rtepad.com

  4. #4
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Steve@rtePad View Post
    If there is a javascript error in your getcalendar function it definitely will cause this behaviour...
    fixed

  5. #5
    SitePoint Enthusiast
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi, thanks for the replies... it seems that is the problem...

    It's an ajax function that's not working

    Could anyone tell me why?

    Code JavaScript:
    function getXMLHTTPRequest(){
    	var request = false;
    	try{
    		/* e.g. Firefox */
    		request = new XMLHttpRequest();
    	}
    	catch(err1){
    		try{
    			/* some versions IE */
    			vrequest = new ActiveXObject("Msxml2.XMLHTTP");
    		}
    		catch(err2){
    			try{
    				/* some versions IE */
    				request = new ActiveXObject("Microsoft.XMLHTTP");
    			}
    			catch(err3){
    				request = false;
    			}
    		}
    	}
    	return request;
    }
     
    var http = getXMLHTTPRequest();
     
    function getCalendar(month, year){
    	var myurl = 'assets/code/calendar.php';
    	myRand = parseInt(Math.random()*999999999999999);
    	var modurl = myurl + "?month=" + month + "&year=" + year + "&rand=" + myRand;
    	http.open("GET", modurl, true);
    	http.onreadystatechange = useHttpResponse;
    	http.send(null);
    }
     
    function useHttpResponse(){
    	if (http.readyState == 4){
    		if(http.status == 200){
    			var calText = http.responseText;
    			document.getElementById('calendar_cont').innerHTML = calText;
    		}
    	} else {
    		document.getElementById('calendar_cont').innerHTML = '<br /><br /><br /><br /><img src="assets/structure/progress.gif">';
    	}
    }

    It works in most browsers apart from IE6...

    Thanks,

  6. #6
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Nelson BC
    Posts
    2,310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Typo?
    Code:
    vrequest = new ActiveXObject("Msxml2.XMLHTTP");
    all the others are called request.

  7. #7
    SitePoint Enthusiast
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    33
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    wow!!! thank you so much

    It was text I copied and pasted from an ajax site so I only briefly looked over it

    It's amazing how many bugs come down to a spelling mistake

  8. #8
    SitePoint Enthusiast
    Join Date
    Nov 2006
    Posts
    30
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lol .. it was a typo.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •