Welcome Guest [Log In] [Register]
This board has been archived and is no longer accepting new questions. If you have a support question for your ZetaBoard, please visit us at the new support board. Registration is free and easy.


Visit the NEW ZetaBoards Support forum!

Username:   Password:
Add Reply
Swap Text help
Topic Started: May 27 2008, 08:50 PM (598 Views)
carastir
Member Avatar
Did you say something?
[ *  *  * ]
yeah, yeah, I know it is Javascript, but It's the only thing I know.

I am having trouble formatting the text to fit my needs.

Code
 
Code Removed


I want to have HTML in the 'This changes' Area. How do I do this? Or can you give me a better code to do this with?

EDIT: I'm obviously very rusty with Javascript. ;)
Edited by carastir, May 29 2008, 05:59 PM.
Offline Profile Quote Post Goto Top
 
RyuraGS
Member Avatar
Member
[ *  *  * ]
I'm going to assume you're on a ZetaBoard while doing this.
First change this:
<a href="http://rpg.divinusdies.net" onmouseover="MM_setTextOfTextfield('text','','This changes')">
To this:
<a href="http://rpg.divinusdies.net" id="mouse_em_up">

Now your script:
$(function() {
var x = $("#mouse_em_up").text();
$("#mouse_em_up").hover(function() {
$(this).text("This Changes");
},function() {
$(this).text(x);
});
});
Offline Profile Quote Post Goto Top
 
carastir
Member Avatar
Did you say something?
[ *  *  * ]
Thank you, but I also want to have more than one of these, so, a series of links that also change the text. (Not all the same.)

Thanks.
Offline Profile Quote Post Goto Top
 
RyuraGS
Member Avatar
Member
[ *  *  * ]
Still simple, give them all a class of hover_on_this or whatever you want, and make their title the text to switch to. Then do this:

Code:
 
$(function() {
var x = $(".hover_on_this").text();
$(".hover_on_this").each(function(i) {
$(this).hover(function() {
$(this).text($(this.attr("title"));
},function() {
$(this).text(x[i]);
});
});
});


Untested but it should work.
Edited by RyuraGS, May 28 2008, 05:27 PM.
Offline Profile Quote Post Goto Top
 
carastir
Member Avatar
Did you say something?
[ *  *  * ]
<a href="http://rpg.divinusdies.net"> with the text:

Code:
 
<span style="font-size:20px">
Blah blah blah blah blah blah blah blah blah blah blah blah blah. Blah blah blah blah blah blah blah blah.<hr /> Blah blah blah blah blah blah blah.<br /><br />
</span><em><span style="font-size:16px;color:red">~ God</em></span>


How would that look?
Offline Profile Quote Post Goto Top
 
RyuraGS
Member Avatar
Member
[ *  *  * ]
Just add a title attribute with the new text you want.

<a href="url" title="new text">old text</a>
Offline Profile Quote Post Goto Top
 
carastir
Member Avatar
Did you say something?
[ *  *  * ]
Posted Image

I want to hover over a link (left) and change the text (Right) What you gave me did not work, GenerationStudio. :(

EDIT:

Some part of the Javascript that did something like calling an array into the area would be great. But I don't know how to add it on. (It would be even more useful if I could have it in just plain Javascript).

Example:
Quote:
 
function gotext(num){
/*
Main text array.
*/
var text = []
text[0] = "<CENTER><b>PM Page</b><BR /><BR /><img src='http://i1.ifrm.com/2601/61/upload/p4052352.jpg'><BR /><BR /></CENTER>You can use the PM page to check, send and receive your private messages on here. Options are available from the CP in the message folder to customise your message viewing."


<a href="#" onmouseover="gotext(0)">link name</a>
Edited by carastir, May 28 2008, 07:45 PM.
Offline Profile Quote Post Goto Top
 
RyuraGS
Member Avatar
Member
[ *  *  * ]
You need to change it a bit then:
Code:
 

$(function() {
var x = $(".hover_on_this").text();
$(".hover_on_this").each(function(i) {
var t = $(this);
t.hover(function() {
$("#id_of_area_with_changed_text").text(t.attr("title"));
},function() {
$("#id_of_area_with_changed_text").text(x[i]);
});
});
});
Offline Profile Quote Post Goto Top
 
carastir
Member Avatar
Did you say something?
[ *  *  * ]
I figured it out :) ... but I could not get any of your codes to work, GenerationStudio. :(
Edited by carastir, May 29 2008, 05:59 PM.
Offline Profile Quote Post Goto Top
 
1 user reading this topic (1 Guest and 0 Anonymous)
« Previous Topic · Coding & Modifications · Next Topic »
Add Reply