vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Simple javascript help (https://vborg.vbsupport.ru/showthread.php?t=170340)

aceofspades 02-12-2008 07:02 PM

Simple javascript help
 
HELP!

Im trying to change a simple image rollover script so that it displays code rather than a new image. For example:

Before roll over: image1.jpg

After roll over <h1><img src="image2.jpg" />Test</h1>

Is this possible?

Regards,

James

--------------- Added [DATE]1202850179[/DATE] at [TIME]1202850179[/TIME] ---------------

This is what i have been trying to convert to replace an image with code, but the src function is tied into it and i cant get it to work.

http://joemaller.com/js-singleroll.shtml

cheesegrits 02-13-2008 03:41 PM

Well that code is very specifically about swapping images in and out on a roll-over, which is not what you want to do. What you'll need to do is wrap your IMG tag in a div, then set the innerHTML property as you roll in and out.

So the div would look something like this:

HTML Code:

<div id="myimage"><img src="image2.jpg"></div>
You can keep the basic structure of the functions in the example you are looking out - the mouseOver and mouseOut functions, but get rid of all the stuff about creating new Image elements.

Then in your mouseOver function, just do something like this:

Code:

document.getElementById('myimage').innerHTML = '<img src="image2.jpg"><h1>Test</h1>';
And in your mouseOut function:

Code:

document.getElementById('myimage').innerHTML = '<img src="image2.jpg">';
-- hugh


All times are GMT. The time now is 01:37 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.00977 seconds
  • Memory Usage 1,714KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_code_printable
  • (1)bbcode_html_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (2)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete