Friday, November 20, 2009

Java Question?

What would be the code to enter for the page to automatically redirect to another page. I know it is a javascript onLoad code.



Java Question?windows xp sp2



You may try this,



%26lt;body onload="dothat()"%26gt;



%26lt;!------------SCRIPT 1--------------%26gt;



%26lt;script%26gt;



function dothis(){



"



"



"



}



window.onload=dothis



%26lt;/script%26gt;



%26lt;!------------END OF SCRIPT 1---%26gt;



%26lt;!-------------SCRIPT 2----------------%26gt;



%26lt;script%26gt;



function dothat(){



"



"



"



}



%26lt;/script%26gt;



%26lt;!------------END OF SCRIPT 2------%26gt;



%26lt;/body%26gt;



Or possibly this,



Code:



%26lt;SCRIPT type="text/javascript"%26gt;



//this gives you xxx.domain.com as a string



var urlString = location.host;



// break it up into pieces



var urlArray = new Array();



urlArray = urlSting.split('.');



//create a new string with the re-ordered url



// domain + com + xxx



var newURL = 'http://' + urlArray[1] + '.' + urlArray[2] + '/' + urlArray[3];



//redirect the userl to newURL



location.href=newURL;



%26lt;/SCRIPT%26gt;

No comments:

Post a Comment

 
nortin