Click to See Complete Forum and Search --> : Multiple Events of Same Method?
I just recently starting getting in depth with HTML, JAVA, and JS, I guess you can say so-so, but as anyone starting out... it's question time!!!
1) I've managed easily to get form style buttons to do image swapping... Not too hard, but is there anyway to do multiple onMouseOver's or onClicks to change various items?
2) Again with the image swapping, I found it pretty easy to do this with form style buttons, but items with an <A HREF> tag... exactly how is this setup? Like a regular link or an image button? I found a DECENT way to just create an anchor, and then do the onClick event, but is there anyway so that it doesn't refresh or have to have a target? Again, I'm working around in HTML and JS mainly atm, so if this easily in JS or something, feedback would be much appreciated. Thank you.
muneepenee
09-14-2005, 01:31 PM
1. the klik or onmouseover kan kall a funkshun. Funk kan hav 1000's av lines av kode & kan kall more funks.
2. 1 wae tu yuze anker...
<a href="javascript:window.print()">print this paej </a>
or
<a href="#" onClick="zoompik('but1')">klik tu make pik bigger</a>
The current way I have been able to do the image swapping, isn't within JS, but within HTML, can HTML be formulated with functions?
is this correct? <A HREF="javascript:window.print()" onClick="document.whatever.src='new image.xxx'">Click Here to Change</A>
The href attribute value should be an URL. JavaScript goes in the event handler, onclick.
muneepenee
09-14-2005, 02:03 PM
1. html is statik...kant muve or chaenj...that meen it kant flip piks.
So then I'm lost... how can you create a regular link using <A HREF> to swap an image? I've been able to do it easiy with Form Button, and I even cheated with hidden anchors for regular <A HREF> Links to not reload the page, so what else can I do?
What are you tring to achieve? Image swapping by clicking a link or an image? Image swapping can be do with css.
ok say I have a single image + other crap on the page... I've been able to swap JUST the image with form styled buttons, using the onClick="document.NAME.src='newimageurl'" tag within the form's code... however, when I've tried doing this with standard links or image links... they need a target URL... is there anyway to set that target url so that it doesn't REFRESH the page? so far, the only way I've been able to do that, is with anchor's, but I know there's another way...
This probably what you are looking for; as long as JavaScript is enabled the anchor will not direct you to the url.
<a href="http://www.mysite.com" onclick="alert('Hi there'); return false;">no refresh</a>
The return false prevents any further action.
Does that go within a <SCRIPT> tag or just simply HTML?
Kravvitz
09-15-2005, 12:32 AM
No, that last piece of code does not go in a <script> element.
Image Switching with CSS (http://www.dynamicsitesolutions.com/css/background_image_switching/)
*** EDITTED ***
Yes, That works perfectly for what I wanted... Thank you... Lastly, is there any way to perform multiple image swapping for different image labels using a single link?
Kravvitz
09-15-2005, 04:01 PM
You're welcome :)
Yes. Just add another statement to the event handler.
hmmmm... I've tried using 2 onClick's on the same <A HREF> tag, but it got pissed off and didn't do anything...
EDITTED...
NEVERMIND, didn't even think about doing the same thing you all did with the return false... same " "'s, just separated by ;'s... thanks for the help.
Kravvitz
09-15-2005, 04:32 PM
Perhaps you forgot the semicolons. Please show us what you tried that didn't work.
Yes, just figured it out, lawl my bad
Kravvitz
09-15-2005, 04:43 PM
Ok. I'm glad you figured it out.
You're welcome :)