Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

documpent.write ? 1

Status
Not open for further replies.

JeroenB

Programmer
Apr 8, 2001
93
BE
Hi,

I have a js file and a html document.
I have made a function which generates a menu onclick
Now I want to put the text which has to appear in that menu in my js-document.
How can I do so (by using document write ?)

Thanx in advance
J

//Start js

var isNS=(document.layers);
if(isNS)document.captureEvents(Event.mousemove);
document.onmousemove=track;

function track(e)
{
var x=(isNS)?e.pageX:event.x;
var y=(isNS)?e.pageY:event.y;
if(isNS)document.captureEvents(Event.onclick);
isvis(x,y);
}

function isvis(x,y) {
if(isNS) {
if(document.quicktour.visibility!="hide") {
if(x<0||x>220||y<0||y>300)document.quicktour.visibility=&quot;hide&quot;;
}
} else if(quicktour.style.visibility!=&quot;hidden&quot;) {
if(x<0||x>220||y<0||y>300)quicktour.style.visibility=&quot;hidden&quot;;
}
}

function menu(x,n) {
if (x==1) {
if(isNS) {document.quicktour.visibility=(n!=0)?&quot;visible&quot;:&quot;hidden&quot;;
} else quicktour.style.visibility=(n!=0)?&quot;visible&quot;:&quot;hidden&quot;;
}
}


//??????????????
function writeQT()
{
document.write ('<b><u>QUICK TOUR</u></b> <br><p><b><u>blablabla</u></b>')
}
//??????????????


//End js



<html>
<head>
<style type=&quot;text/css&quot;>
.test {position:absolute;top:200;left:60;width:160;height:106;}
.menudiv {position:absolute;top:200;left:60;width:160;height:106;background-color:#cccccc;border:solid;border-width:1;border-color:#000000;z-index:10;visibility:hidden;}
</style>

<script language=&quot;JavaScript1.2&quot; src=&quot;quicktour.js&quot;>
</script>
</head>
<body>

<div class=&quot;test&quot;><a href=&quot;#&quot; onclick=&quot;menu(1,1)&quot;>test</A></div>

<div id=&quot;quicktour&quot; class=&quot;menudiv&quot;>
<center>
<b>here must come the text from the function writeQT
</b>
</center>
</div>




</body>
</html>
 
Hi,

try this :

for i.e :

affichage=&quot;<table><td> etc... \n etc.. \n ..etc.. </table>&quot;

document.write:(affichage);

PS : use simple quote in your html code in variable 'affichage'.

Bye !
 
Use:

<div id=&quot;quicktour&quot; class=&quot;menudiv&quot;>
<center>
<b>
<script language=&quot;javascript&quot;>
writeQT();
</script>
</b>
</center>
</div>
 
I just wanted to say the same trollacious LOL (you beat me)

JeroenB, change the co-ordinates if(x<0||x>220||y<0||y>300)document.quicktour.visibility=&quot;hide&quot;; in your
script (on both places) to:

if(x<60||x>220||y<200||y>306)document.quicktour.visibility=&quot;hide&quot;;

to set the mouseOut right,

Hope this helps,
Erik

<!-- My sport: Boomerang throwing !!
This year I will participate at the World Championships in Germany. (!! Many Happy Returns !! -->
 
Well, if you'd posted first, at least I'd have been beaten by one of the best! :)# (bearded smiley face)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top