Menu
Hi, I need some serious help! I am making a photo album in dreamweaver, and I have a list of links that are attached to behaviors… (swap image, etc.) Well, I want captions under my pictures, and I’d like the captions to change with the pictures when you click on the link. Basically, a javascript function. I use dreamweaver, but could insert the code manually if I knew it.
Does anyone know how to do this? Is it possible? Is it even javascript? It’s driving me nuts…
Please help!
<i>
</i>document.getElementById("idofyourspan").firstChild.nodeValue="Texttochangeto";
<div id="mydiv" align="center" style="color:#003300" size: 80%; font-family:Verdana, Arial, Helvetica, sans-serif;">(Text that I want to change) Welcome to my Costa Rica photo album! 8 girls, including me, ventured down into the jungle to find great beaches, and good times. Here are a few pictures of things we found.</div>
Note that I removed your <font> tag, and used CSS instead, as that is the prefered method.<a href="[b]#[/b]" onClick="MM_swapImage('costatitle','','Images/CostaRica/HammokFeetPalm.jpg',1); [b]swapText('this is the text to use'); return false;[/b]">Hammock</a>
function swapText(what) {
document.getElementById("mydiv").firstChild.nodeValue=what; //this will change the text in mydiv to the text you specified when calling the function
}
="MM_swapImage('main','','the park WEB.jpg',1); swapText('The Park Project<br />
is based on this image'); return false;"></div></td>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The Park Project</title>
<style type="text/css">
<!--
body,td,th {
font-family: Verdana;
font-size: 16px;
color: #CCCCCC;
}
body {
background-color: #000000;
}
a {
font-size: 16px;
color: #CCCCCC;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #CCCCCC;
}
a:hover {
text-decoration: none;
color: #CCCCCC;
}
a:active {
text-decoration: none;
color: #CCCCCC;
}
.style1 {color: #000000}
-->
</style>
<script type="text/javascript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function swapText(what) {
document.getElementById("description").innerHTML=what; //this will change the HTML in mydiv to the HTML you specified when calling the function
}
//-->
</script>
<link href="description.css" rel="stylesheet" type="text/css" />
</head>
<body onload="MM_preloadImages('mother and baby WEB.jpg','the park WEB.jpg')">
<table width="900" align="center" bgcolor="#000000">
<tr>
<td width="11">&nbsp;</td>
<td colspan="5" rowspan="3"><div align="center"><img src="the park WEB.jpg" name="main" width="382" height="486" id="main" /><br />
The Park Project</div></td>
<td width="29">&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td height="475">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td width="227"><div align="right"><img src="the park WEB.jpg" name="leftthumb" width="120" height="120" id="leftthumb" onmouseover="MM_swapImage('main','','the park WEB.jpg',1); swapText('The Park Project<br />
is based on this image'); return false;"></div></td>
<td colspan="3"><div id="description" align="center">The Park Project<br />
is based on this image</div></td>
<td width="227"><div align="left"><img src="mother and baby WEB.jpg" name="rightthumb" width="120" height="120" id="rightthumb" onmouseover="MM_swapImage('main','','mother and baby WEB.jpg',1); swapText('mother and baby'); return false;"></div></td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td width="161"><div align="center" class="style1">&lt;&lt; back</div></td>
<td width="44"><div align="center"><a href="http://www.lobacz.com" onmouseover="MM_goToURL('parent','http://www.lobacz.com');return document.MM_returnValue">home</a></div></td>
<td width="155"><div align="center"><a href="page2.html" onmouseover="MM_goToURL('parent','page2.html');return document.MM_returnValue">next &gt;&gt;</a></div></td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>
<link rel='stylesheet' type='text/css' href='table.css'>
<script type="text/javascript" language="JavaScript">
<!--
//Disable right mouse click Script
//By Maximus ([email protected]) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com
var message="© Ted Lobacz";
///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}
function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}
if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}
document.oncontextmenu=new Function("alert(message);return false")
// -->
</script>
</body>
</html>
[CODE]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>The Park Project</title>
<style type="text/css">
<!--
body,td,th {
font-family: Verdana;
font-size: 16px;
color: #CCCCCC;
}
body {
background-color: #000000;
}
a {
font-size: 16px;
color: #CCCCCC;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #CCCCCC;
}
a:hover {
text-decoration: none;
color: #CCCCCC;
}
a:active {
text-decoration: none;
color: #CCCCCC;
}
.style1 {color: #000000}
-->
</style>
<script type="text/javascript">
<!--
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function swapText(what) {
document.getElementById("description").innerHTML=what; //this will change the HTML in mydiv to the HTML you specified when calling the function
}
//-->
</script>
<link href="description.css" rel="stylesheet" type="text/css" />
</head>
<body onload="MM_preloadImages('mother and baby WEB.jpg','the park WEB.jpg')">
<table width="900" align="center" bgcolor="#000000">
<tr>
<td width="11"> </td>
<td colspan="5" rowspan="3"><div align="center"><img src="the park WEB.jpg" name="main" width="382" height="486" id="main" /><br />
The Park Project</div></td>
<td width="29"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td height="475"> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td width="227"><div align="right"><img src="the park WEB.jpg" name="leftthumb" width="120" height="120" id="leftthumb" onmouseover="MM_swapImage('main','','the park WEB.jpg',1); swapText('The Park Project<br />is based on this image'); return false;"></div></td>
<td colspan="3"><div id="description" align="center">The Park Project<br />
is based on this image</div></td>
<td width="227"><div align="left"><img src="mother and baby WEB.jpg" name="rightthumb" width="120" height="120" id="rightthumb" onmouseover="MM_swapImage('main','','mother and baby WEB.jpg',1); swapText('mother and baby'); return false;"></div></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td width="161"><div align="center" class="style1"><< back</div></td>
<td width="44"><div align="center"><a href="http://www.lobacz.com" onmouseover="MM_goToURL('parent','http://www.lobacz.com');return document.MM_returnValue">home</a></div></td>
<td width="155"><div align="center"><a href="page2.html" onmouseover="MM_goToURL('parent','page2.html');return document.MM_returnValue">next >></a></div></td>
<td> </td>
<td> </td>
</tr>
</table>
<link rel='stylesheet' type='text/css' href='table.css'>
<script type="text/javascript" language="JavaScript">
<!--
//Disable right mouse click Script
//By Maximus ([email protected]) w/ mods by DynamicDrive
//For full source code, visit http://www.dynamicdrive.com
var message="© Ted Lobacz";
///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}
function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}
if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}
document.oncontextmenu=new Function("alert(message);return false")
// -->
</script>
</body>
</html>[/CODE]
That works beautifully! Thanks! The way ours differed is that you kept the line break for the second instance, but I took them both out because I thought that that was what you wanted me to do.
But your code works great, thanks again.[/QUOTE]
<i>
</i><script language="javascript">
function swapText(what) {
document.getElementById("myspanid").firstChild.nodeValue=what; //this will change the text in myspanid to the text you specified when calling the function
}
</script>
<FORM ACTION="http://us.2.p9.webhosting.yahoo.com/forms?login=vansawardsplus" METHOD="post" NAME="Personalize" onsubmit="return ValidateForm();">
<INPUT TYPE="hidden" NAME="form" VALUE="contactpage">
<INPUT NAME="Subject" TYPE="hidden" SIZE=32 VALUE="Additional Information for 68CHSA">
<INPUT NAME="Personalize" TYPE="checkbox" VALUE="No"> No Personalization&nbsp;
<p>
<input type="hidden" name="on0" value="Style">
<select name="Style" onchange="swap(this.options[selectedIndex].value)", "swapText('Product Description: 6X8 Gray Speckled Plaque. Plain Bordered plate
with a poem by Carol Huyser.')">
<option value="">Select a Border
<option value="images/68chsa2lrg.jpg">Designer Border
<option value="images/68chsalrg.jpg">Plain Blue Border
</select><br>
<input type="hidden" name="next_url" value="http://www.alwaysinmyheartinc.com/noform/68chsa.htm">
<p><i>Your Email Address:</i><font color=red>*&nbsp; </font>&nbsp;<INPUT NAME="Email_Address" TYPE="text" SIZE=20 VALUE="">&nbsp;&nbsp;
<input type="submit" value="Submit" name="Submitted_Successfully"><input type="reset" value="Reset" name="B2"></p>
</form>
0.1.9 — BETA 5.18