Pramod Nadig Posted September 6, 2006 Share Posted September 6, 2006 Hi i want to know the attribute to an div tag which will open any link in specified target like in "Parent" or "main frame" Eg : <div Id="menuItem1_1" class="menuItem" cmd="BP-Docs\HPSD Personnel Numbers.html" target="_parent">View User Account</div>Here the target is not working, i want the link to open in the main frame or the parent frameSo i want to know the attribute to highligh the link on the parent frame.Can anyone help me... Link to comment Share on other sites More sharing options...
boen_robot Posted September 6, 2006 Share Posted September 6, 2006 <div> elements can't serve as linking elements. Only anchors can. In HTML 4, XHTML 1.0, XHTML 1.1 that is. XHTML 2 is expected to allow every element to be used as a link with the "href" attribute, the same way that anchors are today.What is this "cmd" attribute for anyway? Link to comment Share on other sites More sharing options...
Pramod Nadig Posted September 6, 2006 Author Share Posted September 6, 2006 Good question Boen, bcoz i forgot the javascript where they have named the class in that name which is mentioned as "cmd", im sorry but i just want to know how to open the link in the parent page, i am not able to find where to change the code which will help me do it.il will paste the whole javascript below function InitMenu() { var bar = menuBar.children for(var i=0;i < bar.length;i++) { var menu=eval(bar.menu) menu.style.visibility = "hidden" bar.onmouseover = new Function("ShowMenu("+bar.id+")") var Items = menu.children for(var j=0; j<Items.length; j++) { var menuItem = eval(Items[j].id) if(menuItem.menu != null) { menuItem.innerHTML += "<Span Id="+menuItem.id+"_Arrow class='Arrow'>4</Span>" //var tmp = eval(menuItem.id+"_Arrow") // tmp.style.pixelLeft = menu.getBoundingClientRect().Right //- tmp.offsetWidth - 15 FindSubMenu(menuItem.menu)} if(menuItem.cmd != null) { menuItem.onclick = new Function("Do("+menuItem.id+")") } menuItem.onmouseover = new Function("highlight("+Items[j].id+")") } } } function FindSubMenu(subMenu) { var menu=eval(subMenu) var Items = menu.children for(var j=0; j<Items.length; j++) { menu.style.visibility = "hidden" var menuItem = eval(Items[j].id) if(menuItem.menu!= null) { menuItem.innerHTML += "<Span Id="+menuItem.id+"_Arrow class='Arrow'>4</Span>" // var tmp = eval(menuItem.id+"_Arrow") //tmp.style.pixelLeft = 35 //menuItem.getBoundingClientRect().right - tmp.offsetWidth - 15 FindSubMenu(menuItem.menu) } if(menuItem.cmd != null) { menuItem.onclick = new Function("Do("+menuItem.id+")") } menuItem.onmouseover = new Function("highlight("+Items[j].id+")") } } function ShowMenu(obj) { HideMenu(menuBar) var menu = eval(obj.menu) var bar = eval(obj.id) bar.className="barOver" menu.style.visibility = "visible" menu.style.pixelTop = obj.getBoundingClientRect().top + obj.offsetHeight + Bdy.scrollTop menu.style.pixelLeft = obj.getBoundingClientRect().left + Bdy.scrollLeft } function highlight(obj) { var PElement = eval(obj.parentElement.id) if(PElement.hasChildNodes() == true) { var Elements = PElement.children for(var i=0;i<Elements.length;i++) { TE = eval(Elements.id) TE.className = "menuItem" } } obj.className="ItemMouseOver" window.defaultStatus = obj.title ShowSubMenu(obj) } function Do(obj) { var cmd = eval(obj).cmd window.navigate(cmd) } function HideMenu(obj) { if(obj.hasChildNodes()==true) { var child = obj.children for(var j =0;j<child.length;j++) { if (child[j].className=="barOver") {var bar = eval(child[j].id) bar.className="Bar"} if(child[j].menu != null) { var childMenu = eval(child[j].menu) if(childMenu.hasChildNodes()==true) HideMenu(childMenu) childMenu.style.visibility = "hidden" } } } } function ShowSubMenu(obj) { PMenu = eval(obj.parentElement.id) HideMenu(PMenu) if(obj.menu != null) { var menu = eval(obj.menu) menu.style.visibility = "visible" menu.style.pixelTop = obj.getBoundingClientRect().top + Bdy.scrollTop menu.style.pixelLeft = obj.getBoundingClientRect().right + Bdy.scrollLeft if(menu.getBoundingClientRect().right > window.screen.availWidth ) menu.style.pixelLeft = obj.getBoundingClientRect().left - menu.offsetWidth } } Link to comment Share on other sites More sharing options...
boen_robot Posted September 6, 2006 Share Posted September 6, 2006 I'm scared to ask what this JS does (it looks scary).Well, as I said, use anchors instead. In other words: <a> elements.Eg : <a Id="menuItem1_1" class="menuItem" cmd="BP-Docs\HPSD Personnel Numbers.html" target="_parent">View User Account</a> Link to comment Share on other sites More sharing options...
Pramod Nadig Posted September 6, 2006 Author Share Posted September 6, 2006 I am working on a menu and it includes div tag, and i want to know if i can used anchor tag inside an div. if so can u give an example.here is the example of an div tag which im usingeg : <link href="file:///C|/Documents and Settings/Administrator/Desktop/AAAA MENU TEST/CascadeMenu.css" rel="stylesheet"><script language="javascript" src="file:///C|/Documents and Settings/Administrator/Desktop/AAAA MENU TEST/CascadeMenu.js"></script></head><BODY OnLoad="InitMenu()" Onclick="HideMenu(menuBar)" ID="Bdy" bgColor=aliceblue topmargin="0" leftmargin="0"><!-- STEP THREE: Copy this code into the BODY of your HTML document --><DIV Id="menuBar" class="menuBar" > <DIV Id="Bar1" class="Bar" menu="menu1">BP Acc and Pwd </DIV> <DIV Id="Bar2" class="Bar" menu="menu2">SSO Related </DIV> <DIV Id="Bar3" class="Bar" menu="menu3">BP Related </DIV> <DIV Id="Bar4" class="Bar" menu="menu4">RFA Issue </DIV> <DIV Id="Bar5" class="Bar" menu="menu5">VPN / ARA </DIV></DIV><!--MenuItem Definition --><div Id="menu1" class="menu" > <div Id="menuItem1_1" class="menuItem" cmd="BP-Docs\HPSD Personnel Numbers.html#_parent" title="HPSD Personnel Numbers" >View User Account</div> <div Id="menuItem1_2" class="menuItem">Enable User Account</div> <div Id="menuItem1_3" class="menuItem">Disable User Account</div> <div Id="menuItem1_4" class="menuItem">Reset SSO Password</div></div><div Id="menu2" class="menu"> <div Id="menuItem2_1" class="menuItem">Chanfing SSO Profile</div> <div Id="menuItem2_2" class="menuItem">Changing SSO ID</div> <div Id="menuItem2_3" class="menuItem">Deleting SSO ID</div> <div Id="menuItem2_4" class="menuItem">Changing E-mail ID</div> <div Id="menuItem2_5" class="menuItem">Changing Link ID</div></div><div Id="menu3" class="menu"> <div Id="menuItem3_1" class="menuItem" menu="menu8">Business Partner Portal</div> <div Id="menuItem3_2" class="menuItem">BP E-Contract</div></div><div Id="menu4" class="menu"> <div Id="menuItem4_1" class="menuItem">RFA Login Steps</div> <div Id="menuItem4_2" class="menuItem">Serial No Swap out</div> <div Id="menuItem4_3" class="menuItem">Deleting Transaction</div> <div Id="menuItem4_4" class="menuItem">Delivering License file</div> <div Id="menuItem4_5" class="menuItem">Adding Serial No To RFA</div> <div Id="menuItem4_6" class="menuItem">Version Revert back</div> <div Id="menuItem4_7" class="menuItem">Modify RFA Record</div> </div><div id="menu5" class="menu"> <div Id="menuItem5_1" class="menuItem">Page #4-1</div> <div Id="menuItem5_2" class="menuItem">Page #4-2</div> <div Id="menuItem5_3" class="menuItem">Page #4-3</div></div><div id="menu6" class="menu"> <div Id="menuItem6_1" class="menuItem">Page #1-1</div> <div Id="menuItem6_2" class="menuItem">Page #1-2</div> <div Id="menuItem6_3" class="menuItem" menu="menu7">SubMenu #1-1</div></div></body></html> Link to comment Share on other sites More sharing options...
boen_robot Posted September 6, 2006 Share Posted September 6, 2006 All a <div> defines is a devision. A part of the page. Achors define a clickable link. You should re-learn HTML. Elements can be nested in one another, simply by marking the inner element with the outer one. For example, in your case: <DIV Id="Bar1" class="Bar"><a href="BP-Docs\HPSD Personnel Numbers.html">BP Acc and Pwd</a></DIV> A valid case (as far as I remember) is: <a href="BP-Docs\HPSD Personnel Numbers.html"><DIV Id="Bar1" class="Bar">BP Acc and Pwd</DIV></a> Link to comment Share on other sites More sharing options...
Pramod Nadig Posted September 7, 2006 Author Share Posted September 7, 2006 You are really true, i need to rushup from the root, but to be frank i have very less time and will get very silly doubts, hope u dont mind in future too. And am very thankfull coz the anchor tag really soved the problem... Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now