Gamingforce Interactive Forums
85240 35212

Go Back   Exploding Garrmondo Weiner Interactive Swiss Army Penis > Garrmondo Network > Help Desk
Register FAQ GFWiki Community Donate Arcade ChocoJournal Calendar

Notices

Welcome to the Exploding Garrmondo Weiner Interactive Swiss Army Penis.
GFF is a community of gaming and music enthusiasts. We have a team of dedicated moderators, constant member-organized activities, and plenty of custom features, including our unique journal system. If this is your first visit, be sure to check out the FAQ or our GFWiki. You will have to register before you can post. Membership is completely free (and gets rid of the pesky advertisement unit underneath this message).


JavaScript Assistance
Reply
 
Thread Tools
Zergrinch
Evil Grinch


Member 666

Level 50.98

Mar 2006


Reply With Quote
Old Nov 13, 2006, 03:27 AM Local time: Nov 13, 2006, 04:27 PM #1 of 4
Post JavaScript Assistance

I'm a n00b to programming and all that, and I seek help on pulling off this little project:

I basically type in a stock quote in the text box, and would like the Javascript to automatically update the image below. Right now the relevant data that needs to be changed is called "part2". For the moment, it is hard-coded to "PNB", but I seek ways to make this changeable and updateable.

I've been told that PHP may or may not be a more effective way to pull this off. I have no idea, but any solution that works (not necessarily confined to JavaScript) is welcome!

My HTML page is attached below, renamed as a TXT file. Alternatively, access it here.

Thanks in advance!

Jam it back in, in the dark.
Single Post URL
Transparent Color Code:
[color=#14194e]

Last edited by Zergrinch; Jun 3, 2008 at 03:36 AM.
UltimaIchijouji
Gold Chocobo


Member 789

Level 28.86

Mar 2006


Reply With Quote
Old Nov 13, 2006, 07:21 AM #2 of 4
Originally Posted by Zergrinch
I'm a n00b to programming and all that, and I seek help on pulling off this little project:

I basically type in a stock quote in the text box, and would like the Javascript to automatically update the image below. Right now the relevant data that needs to be changed is called "part2". For the moment, it is hard-coded to "PNB", but I seek ways to make this changeable and updateable.

I've been told that PHP may or may not be a more effective way to pull this off. I have no idea, but any solution that works (not necessarily confined to JavaScript) is welcome!

My HTML page is attached below, renamed as a TXT file. Alternatively, access it here.

Thanks in advance!
It looks to me as if you've made the form and you're making the image, but you aren't using any of the information from the form. I can't really help you off the top of my head since I usually use PHP with forms and I'm really not a JS person except for aesthetic elements, but if no one helps you when I get home I'll look into some stuff for you. For now, I have school to be at.

There's nowhere I can't reach.
Bigblah
Tails is incompetent!


Member 5

Level 45.31

Feb 2006


Reply With Quote
Old Nov 13, 2006, 08:06 AM Local time: Nov 13, 2006, 09:06 PM #3 of 4
If you want to use Javascript, then first of all you need to stop the submit button from refreshing the page (by adding a 'return false' statement, I think).

Next, you need to give your dynamic elements identifiers so that Javascript can access them easily. For this:

<img src='" + part1 + part2 + part3a + "'>

Give it an id, say:

<img id='image1' src='" + part1 + part2 + part3a + "'>

And 'image2' for the other image.

Add the following to your readtext function:

document.images["image1"].src = part1 + part2 + part3a;
document.images["image2"].src = part1 + part2 + part3b;


This probably isn't fully cross-browser compatible, but at least it works on the latest versions of Firefox and IE.

And if you want to update the captions on the page, you'll have to do something similar:

"<b><span id='caption1'>" + part2 + '</span> - MACD </b><br>'

And use innerHTML or any equivalent function.

(By the way, you're passing this.form into readtext but not using it, so might as well eliminate the parameter.)

Most amazing jew boots
Zergrinch
Evil Grinch


Member 666

Level 50.98

Mar 2006


Reply With Quote
Old Nov 13, 2006, 09:13 PM Local time: Nov 14, 2006, 10:13 AM #4 of 4
Woot, it worked - implementation here. Thanks, Gigablah!

I am a dolphin, do you want me on your body?
Single Post URL
Transparent Color Code:
[color=#14194e]
Reply


Exploding Garrmondo Weiner Interactive Swiss Army Penis > Garrmondo Network > Help Desk > JavaScript Assistance

Forum Jump


All times are GMT -5. The time now is 12:15 PM.


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