Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Div help
Index -> Graphics and Design, Web Design -> (X)HTML Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Amailer




PostPosted: Sun Apr 04, 2004 11:42 pm   Post subject: Div help

Hey,
Is there a way to make div tags contain some info that i can call when ever i put...like
<div id="1">
or something?
Sponsor
Sponsor
Sponsor
sponsor
JayLo




PostPosted: Mon Apr 05, 2004 4:13 pm   Post subject: (No subject)

you might have to use javascript...
actually, explain the thing you want more. i don't really understand.
jonos




PostPosted: Tue Apr 06, 2004 4:24 pm   Post subject: (No subject)

if you're trying to apply text attricutes you'll be best to use css, and calling (i think this is write):

<div class="name of style">
JayLo




PostPosted: Wed Apr 07, 2004 5:18 pm   Post subject: (No subject)

code:
<html>
<head>
<script type="text/javascript">
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)];
}
</script>
</head>
<body>
<img onMouseOver="h1(this.src,true)" src="logo01.gif" border="0"><img onMouseOver="h1(this.src,true)" src="logo02.jpg" border="0">
<!-- id="text" is linked to the javascript. this is where the text from the imagemap goes.-->
<div id="text" style="width:650px; height:180px; overflow:auto; padding:5;">
Good Stuff.
</div>
</body>
</html>


read through this... maybe it's what you need. Wink
Amailer




PostPosted: Wed Apr 07, 2004 5:25 pm   Post subject: (No subject)

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




PostPosted: Fri Apr 09, 2004 5:45 pm   Post subject: (No subject)

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:

code:
myDiv = getElementByID("some_div");
myDiv.visible = true;


The actual code may be different than that.
PaddyLong




PostPosted: Sat Apr 10, 2004 11:51 am   Post subject: (No subject)

hmm... maybe something like...

code:

var splitLoc = location.value.split("#");
if (splitLoc[1].match("divnumber"))
{
    myDiv = getElementByID("divnumber");
    myDiv.visible = true;
}
Amailer




PostPosted: Sat Apr 10, 2004 1:10 pm   Post subject: (No subject)

Okay this is what it hsould be..
code:

<html>
<head>
<script language="JavaScript" type="text/JavaScript">
var splitLoc = location.value.split("#");
if (splitLoc[1].match("divnumber"))
{
    myDiv = getElementByID("divnumber");
    myDiv.visible = true;
}
</script>


<div id="1" STYLE="visibility:hidden">
OMG THAT'S AMAZING!!!
</div>
</head>
<body>
</body>
</html>

See how the div is hidden? can it bs so that javascript can change hte style of the visibility to visiable?

edit.
code:

<SCRIPT>
var splitLoc = location.value.split("#");

myDiv = getElementByID("divnumber");

if (splitLoc[1].match("divnumber"))
{
    myDiv.style.visibility="hidden";
} else {
    myDiv.style.visibility="visible";
}
</SCRIPT>
I know it's wrong but.. maby fixable.
PaddyLong




PostPosted: Sun Apr 11, 2004 3:04 pm   Post subject: (No subject)

here... this one works

file.html doesn't show it
file.html#divnumber shows it

code:

<html>
<head></head>
<body>

<div id="1" STYLE="visibility:hidden">
OMG THAT'S AMAZING!!!
</div>

<script type="text/javascript">
var splitLoc = document.URL.split("#");
if (splitLoc[1].match("divnumber"))
{
        document.getElementById('1').style.visibility="visible";
}
</script>
</body>
</html>
Amailer




PostPosted: Sun Apr 11, 2004 3:51 pm   Post subject: (No subject)

i don't think it does.. well not for me atleast :S oh wlel
PaddyLong




PostPosted: Sun Apr 11, 2004 8:08 pm   Post subject: (No subject)

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




PostPosted: Thu Jun 10, 2004 6:43 pm   Post subject: (No subject)

~are u sure that div can be coded as hidden~
~~anyways~this is the code i use for my site on div~

code:

<div style="position: absolute; top: 0px; left: 0px; width: 648px;">
<SOMETHING SOMETHING>
</div>

<br>

<div style="position: absolute; top: 25px; left: 205px; width: 220px;">
<center>
<SOMETHING SOMETHING>
</div>
Display posts from previous:   
   Index -> Graphics and Design, Web Design -> (X)HTML Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 12 Posts ]
Jump to:   


Style:  
Search: