
-----------------------------------
Amailer
Sun Apr 04, 2004 11:42 pm

Div help
-----------------------------------
Hey,
Is there a way to make div tags contain some info that i can call when ever i put...like

or something?

-----------------------------------
JayLo
Mon Apr 05, 2004 4:13 pm


-----------------------------------
you might have to use javascript...
actually, explain the thing you want more. i don't really understand.

-----------------------------------
jonos
Tue Apr 06, 2004 4:24 pm


-----------------------------------
if you're trying to apply text attricutes you'll be best to use css, and calling (i think this is write):



-----------------------------------
JayLo
Wed Apr 07, 2004 5:18 pm


-----------------------------------



function h1(name)
{
//get the number of the picture
//for example logo01.gif will make id 01
var id = name.substring(name.length-6,name.length-4);
//it's hard-coded so that you have a set amount of pictures. in this case two.
var pictures=new Array(2);

pictures[1]  = "One";
pictures[2]  = "Two";
//when you mouseover logo01 or 02, it'll make the div area "text" have that value of
// pictures [1] or [2]
document.getElementById('text').innerHTML = pictures[parseInt(id,10)];
}






Good Stuff.




read through this... maybe it's what you need. ;)

-----------------------------------
Amailer
Wed Apr 07, 2004 5:25 pm


-----------------------------------
err no lol woops forgot about this topic..
what i ment is.. can i stroe information in a div tag and that only if i call it by mydomain#divnumber it displays the info?

-----------------------------------
wtd
Fri Apr 09, 2004 5:45 pm


-----------------------------------
You can use Javas cript to toggle the visibility of an element in a page.  "Element" in this case includes "div".  You'd have to use Javascript to parse the query string (everything that follows the question mark) and I'm not quite sure how to do that.

Then you'd just do something like:

myDiv = getElementByID("some_div");
myDiv.visible = true;

The actual code may be different than that.

-----------------------------------
PaddyLong
Sat Apr 10, 2004 11:51 am


-----------------------------------
hmm... maybe something like... 


var splitLoc = location.value.split("#");
if (splitLoc[1].match("divnumber"))
{
    myDiv = getElementByID("divnumber"); 
    myDiv.visible = true;
}


-----------------------------------
Amailer
Sat Apr 10, 2004 1:10 pm


-----------------------------------
Okay this is what it hsould be..




var splitLoc = location.value.split("#");
if (splitLoc[1].match("divnumber"))
{
    myDiv = getElementByID("divnumber");
    myDiv.visible = true;
} 




OMG THAT'S AMAZING!!!






See how the div is hidden? can it bs so that javascript can change hte style of the visibility to visiable?

edit.


var splitLoc = location.value.split("#");

myDiv = getElementByID("divnumber");

if (splitLoc[1].match("divnumber"))
{
    myDiv.style.visibility="hidden"; 
} else {
    myDiv.style.visibility="visible"; 
}

 I know it's wrong but.. maby fixable.

-----------------------------------
PaddyLong
Sun Apr 11, 2004 3:04 pm


-----------------------------------
here... this one works

file.html  doesn't show it
file.html#divnumber  shows it






 
OMG THAT'S AMAZING!!! 



var splitLoc = document.URL.split("#");
if (splitLoc[1].match("divnumber"))
{
	document.getElementById('1').style.visibility="visible";
}





-----------------------------------
Amailer
Sun Apr 11, 2004 3:51 pm


-----------------------------------
i don't think it does.. well not for me atleast :S oh wlel

-----------------------------------
PaddyLong
Sun Apr 11, 2004 8:08 pm


-----------------------------------
if you're using mozilla there's a chance it won't work...  you'll most likely need to add in some extra code to deal with cross-browser compatibility

-----------------------------------
Kamikagushi
Thu Jun 10, 2004 6:43 pm


-----------------------------------
~are u sure that div can be coded as hidden~
~~anyways~this is the code i use for my site on div~













