flyguye
02-09-2007, 05:50 AM
Hi there, Im learning how to create a custom skin & am toying with a stripped down version of Luna skin. Can anyone help with this issue, i would like to know how to put a javascript in the catergories menu to set a target window.
I'll see if i can explain better. At www.mapa.org.my/index.php i have an ajax script which launches the requested page in the DIV called "iframe" . If you click the link called "test" below the catergories menu in, you"ll see what i mean. What i want to do is to be able to have links from my catergories menu also target that "iframe" DIV. What code do i put to get my links "target" from the catergories menu to show up in the DIV. Below is the page source to see the whole script. Please help as i am not good at this.
----------------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Website Title - Home</title>
<meta name="description" content="Website description" />
<meta name="keywords" content="Website Keywords" />
<script type="text/javascript">
/***********************************************
* Dynamic Ajax Content- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
var bustcacheparameter=""
function ajaxpage(url, containerid){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
}
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
if (bustcachevar) //if bust caching of external page
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)
page_request.send(null)
}
function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=pag e_request.responseText
}
function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}
</script>
<base href="http://mapa.org.my/"/>
<script type="text/javascript">
<!--
var TMenu_path_to_files="http://mapa.org.my/includes/javascript/hovermenu/";
//-->
</script>
<script type="text/javascript" src="includes/javascript/skin_functions.js"></script>
<script type="text/javascript" src="includes/javascript/hovermenu/menu.js"></script> <link rel="stylesheet" type="text/css" href="skins/luna/styles.css" />
<link rel="stylesheet" type="text/css" href="skins/luna/menu.css" />
<link rel="stylesheet" type="text/css" href="skins/mapabeta1/styles.css" />
</head>
<body>
<div id="login">
<form action="http://mapa.org.my/index.php?categoryid=1" method="post" name="loginbox">
<input type="hidden" name="login" value="login" >
<table border="0" cellspacing="0" cellpadding="0">
<tr><td>
<style="padding-bottom: 0px;">
<input name="loginusername" value="username" onFocus="if(this.value==this.defaultValue)this.value=''" onBlur="if(this.value=='')this.value=this.defaultValue" type="text" size="15" style="color: #709DB3; font-family: Trebuchet MS;font-size: 8pt; background-color: #234669; border: 1px solid #709DB3;"></td></tr>
<tr><td>
<style="padding-bottom: 4px;">
<input name="loginpassword" value="********" onFocus="if(this.value==this.defaultValue)this.value=''" onBlur="if(this.value=='')this.value=this.defaultValue" type="password" size="15" style="color: #709DB3; font-family: Trebuchet MS;font-size: 8pt; background-color: #234669; border: 1px solid #709DB3;"> <input type="image" name="Submit now" value="Login" src="../images/loginbuttforum.gif" width="43" height="17"></td></tr>
<tr><td>
<style="padding-bottom: 4px;">
<input class="checkbox" type="checkbox" name="rememberme" unchecked="unchecked" style="color: #709DB3; background-color: #234669; border: 1px solid #709DB3;"/> Remember Me
</td></tr><tr>
<td><a href="http://mapa.org.my/forum/profile.php?mode=sendpassword">Forgot your password?</a></td>
</tr></table>
</form>
</div>
<div class="navigation_4"><table border="0" cellpadding="0" cellspacing="0" summary="Not Available"><tr><td class="bullet_2" onMouseOver="this.className='bullet_2_hover'" onMouseOut="this.className='bullet_2'"><a href="http://mapa.org.my/index.php?categoryid=1" class="sdcategory">Home</a></td><td class="bullet_2" onMouseOver="this.className='bullet_2_hover'" onMouseOut="this.className='bullet_2'"><a href="http://mapa.org.my/index.php?categoryid=2" class="sdcategory">Guestbook</a></td><td class="bullet_2" onMouseOver="this.className='bullet_2_hover'" onMouseOut="this.className='bullet_2'"><a href="http://mapa.org.my/index.php?categoryid=3" class="sdcategory">Image Gallery</a></td><td class="bullet_2" onMouseOver="this.className='bullet_2_hover'" onMouseOut="this.className='bullet_2'"><a href="http://mapa.org.my/index.php?categoryid=4" class="sdcategory">Links</a></td><td class="bullet_2" onMouseOver="this.className='bullet_2_hover'" onMouseOut="this.className='bullet_2'"><a href="http://mapa.org.my/index.php?categoryid=5" class="sdcategory">Contact</a></td><td class="bullet_2" onMouseOver="this.className='bullet_2_hover'" onMouseOut="this.className='bullet_2'"><a href="http://mapa.org.my/index.php?categoryid=6" class="sdcategory">Register</a></td><td class="bullet_2" onMouseOver="this.className='bullet_2_hover'" onMouseOut="this.className='bullet_2'"><a href="http://mapa.org.my/index.php?categoryid=7" class="sdcategory">Profile</a></td><td class="bullet_2" onMouseOver="this.className='bullet_2_hover'" onMouseOut="this.className='bullet_2'"><a href="http://mapa.org.my/index.php?categoryid=10" class="sdcategory">Test</a></td></tr></table></div>
<a href="javascript:ajaxpage('../history.htm', 'iframe');">test</a>
<a target="iframe" href="../history.htm">testing</a>
<div id="iframe"></div>
</body>
</html>
I'll see if i can explain better. At www.mapa.org.my/index.php i have an ajax script which launches the requested page in the DIV called "iframe" . If you click the link called "test" below the catergories menu in, you"ll see what i mean. What i want to do is to be able to have links from my catergories menu also target that "iframe" DIV. What code do i put to get my links "target" from the catergories menu to show up in the DIV. Below is the page source to see the whole script. Please help as i am not good at this.
----------------------------------------------------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Website Title - Home</title>
<meta name="description" content="Website description" />
<meta name="keywords" content="Website Keywords" />
<script type="text/javascript">
/***********************************************
* Dynamic Ajax Content- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
var bustcachevar=1 //bust potential caching of external pages after initial request? (1=yes, 0=no)
var loadedobjects=""
var rootdomain="http://"+window.location.hostname
var bustcacheparameter=""
function ajaxpage(url, containerid){
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
}
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.onreadystatechange=function(){
loadpage(page_request, containerid)
}
if (bustcachevar) //if bust caching of external page
bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime()
page_request.open('GET', url+bustcacheparameter, true)
page_request.send(null)
}
function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=pag e_request.responseText
}
function loadobjs(){
if (!document.getElementById)
return
for (i=0; i<arguments.length; i++){
var file=arguments[i]
var fileref=""
if (loadedobjects.indexOf(file)==-1){ //Check to see if this object has not already been added to page before proceeding
if (file.indexOf(".js")!=-1){ //If object is a js file
fileref=document.createElement('script')
fileref.setAttribute("type","text/javascript");
fileref.setAttribute("src", file);
}
else if (file.indexOf(".css")!=-1){ //If object is a css file
fileref=document.createElement("link")
fileref.setAttribute("rel", "stylesheet");
fileref.setAttribute("type", "text/css");
fileref.setAttribute("href", file);
}
}
if (fileref!=""){
document.getElementsByTagName("head").item(0).appendChild(fileref)
loadedobjects+=file+" " //Remember this object as being already added to page
}
}
}
</script>
<base href="http://mapa.org.my/"/>
<script type="text/javascript">
<!--
var TMenu_path_to_files="http://mapa.org.my/includes/javascript/hovermenu/";
//-->
</script>
<script type="text/javascript" src="includes/javascript/skin_functions.js"></script>
<script type="text/javascript" src="includes/javascript/hovermenu/menu.js"></script> <link rel="stylesheet" type="text/css" href="skins/luna/styles.css" />
<link rel="stylesheet" type="text/css" href="skins/luna/menu.css" />
<link rel="stylesheet" type="text/css" href="skins/mapabeta1/styles.css" />
</head>
<body>
<div id="login">
<form action="http://mapa.org.my/index.php?categoryid=1" method="post" name="loginbox">
<input type="hidden" name="login" value="login" >
<table border="0" cellspacing="0" cellpadding="0">
<tr><td>
<style="padding-bottom: 0px;">
<input name="loginusername" value="username" onFocus="if(this.value==this.defaultValue)this.value=''" onBlur="if(this.value=='')this.value=this.defaultValue" type="text" size="15" style="color: #709DB3; font-family: Trebuchet MS;font-size: 8pt; background-color: #234669; border: 1px solid #709DB3;"></td></tr>
<tr><td>
<style="padding-bottom: 4px;">
<input name="loginpassword" value="********" onFocus="if(this.value==this.defaultValue)this.value=''" onBlur="if(this.value=='')this.value=this.defaultValue" type="password" size="15" style="color: #709DB3; font-family: Trebuchet MS;font-size: 8pt; background-color: #234669; border: 1px solid #709DB3;"> <input type="image" name="Submit now" value="Login" src="../images/loginbuttforum.gif" width="43" height="17"></td></tr>
<tr><td>
<style="padding-bottom: 4px;">
<input class="checkbox" type="checkbox" name="rememberme" unchecked="unchecked" style="color: #709DB3; background-color: #234669; border: 1px solid #709DB3;"/> Remember Me
</td></tr><tr>
<td><a href="http://mapa.org.my/forum/profile.php?mode=sendpassword">Forgot your password?</a></td>
</tr></table>
</form>
</div>
<div class="navigation_4"><table border="0" cellpadding="0" cellspacing="0" summary="Not Available"><tr><td class="bullet_2" onMouseOver="this.className='bullet_2_hover'" onMouseOut="this.className='bullet_2'"><a href="http://mapa.org.my/index.php?categoryid=1" class="sdcategory">Home</a></td><td class="bullet_2" onMouseOver="this.className='bullet_2_hover'" onMouseOut="this.className='bullet_2'"><a href="http://mapa.org.my/index.php?categoryid=2" class="sdcategory">Guestbook</a></td><td class="bullet_2" onMouseOver="this.className='bullet_2_hover'" onMouseOut="this.className='bullet_2'"><a href="http://mapa.org.my/index.php?categoryid=3" class="sdcategory">Image Gallery</a></td><td class="bullet_2" onMouseOver="this.className='bullet_2_hover'" onMouseOut="this.className='bullet_2'"><a href="http://mapa.org.my/index.php?categoryid=4" class="sdcategory">Links</a></td><td class="bullet_2" onMouseOver="this.className='bullet_2_hover'" onMouseOut="this.className='bullet_2'"><a href="http://mapa.org.my/index.php?categoryid=5" class="sdcategory">Contact</a></td><td class="bullet_2" onMouseOver="this.className='bullet_2_hover'" onMouseOut="this.className='bullet_2'"><a href="http://mapa.org.my/index.php?categoryid=6" class="sdcategory">Register</a></td><td class="bullet_2" onMouseOver="this.className='bullet_2_hover'" onMouseOut="this.className='bullet_2'"><a href="http://mapa.org.my/index.php?categoryid=7" class="sdcategory">Profile</a></td><td class="bullet_2" onMouseOver="this.className='bullet_2_hover'" onMouseOut="this.className='bullet_2'"><a href="http://mapa.org.my/index.php?categoryid=10" class="sdcategory">Test</a></td></tr></table></div>
<a href="javascript:ajaxpage('../history.htm', 'iframe');">test</a>
<a target="iframe" href="../history.htm">testing</a>
<div id="iframe"></div>
</body>
</html>