9 Replies - 1680 Views - Last Post: 23 March 2002 - 04:00 PM

#1 Shannon  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 13-March 02

How do I change CELL BG IMAGE on reload

Posted 13 March 2002 - 01:03 PM

Hello, I'm seeking a javascript or cgi code or something to change the background image inside a cell only, not the whole page. I have searched and can only find scripts to change the whole page background image or the background color of a table or cell on roll over...but I want to change the cell background IMAGE on RELOAD!

I do not write code but I understand how to use most of it.

Can you help please?

Thanks,
Shannon

Is This A Good Question/Topic? 0
  • +

Replies To: How do I change CELL BG IMAGE on reload

#2 Quik  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 2
  • View blog
  • Posts: 3,750
  • Joined: 06-March 01

Re: How do I change CELL BG IMAGE on reload

Posted 13 March 2002 - 02:32 PM

If you know php at all its a possible solution.
example:
<?
<td background=$query>
?>


now, in the url,
index.php?query=bg1.gif would show bg1.gif in that cell.
and
index.php?query=bg2.gif would show bg2.gif...
I suggest you learn some backend scripting.

Was This Post Helpful? 0
  • +
  • -

#3 supernova333  Icon User is offline

  • D.I.C Addict

Reputation: 4
  • View blog
  • Posts: 590
  • Joined: 12-March 02

Re: How do I change CELL BG IMAGE on reload

Posted 15 March 2002 - 07:08 AM

I'm not a php wiz, but an easy way to do this with cgi is to call a script like this via SSI:

#!/usr/local/bin/perl
$random_file = "image.dat";
open (FILE, $random_file);
@LINES=<FILE>;  
close(FILE);
srand;
print "

$LINES[int rand(@LINES)]
";

------------------------------------------
The contents of image.dat would look like this:

main/main1.jpg
main/main2.jpg
main/main3.jpg

------------------------------------------
The code on your .shtml  doc would look like this:

<td background="INCLUDE HERE">cell contents</td>

------------------------------
I am using this on http://www.fabulousknobs.com if you reload the page, it randomly picks from 3 images.


Was This Post Helpful? 0
  • +
  • -

#4 Shannon  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 13-March 02

Re: How do I change CELL BG IMAGE on reload

Posted 15 March 2002 - 01:12 PM

Thank you both for your replies,

Supernova333, I think I can do that. I'll be back either way and let you know and probably have another question.

Thanks,
Shannon

Was This Post Helpful? 0
  • +
  • -

#5 supernova333  Icon User is offline

  • D.I.C Addict

Reputation: 4
  • View blog
  • Posts: 590
  • Joined: 12-March 02

Re: How do I change CELL BG IMAGE on reload

Posted 20 March 2002 - 12:00 PM

were you able to get that working?  i could always email you the files if that would be easier.  feel free to post or email me with questions.
Was This Post Helpful? 0
  • +
  • -

#6 Shannon  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 13-March 02

Re: How do I change CELL BG IMAGE on reload

Posted 21 March 2002 - 10:31 PM

Oh, thanks for coming back supernova333. I would love it if you could email me the files. I don't understand the SSI part you described. I mean, I have a clue about it, OH!!!!! I see, I think you mean to put the >!--#exec cgi="/cgi-bin/RANDOMPIC.cgi" --< where you say INCLUDE HERE... is that right?

____Quik and All____
I'm into learning some backend scripting, but I'm usually off the planet. I know how to write html, use javascript and applets, use cgi scripts and simple calls with SSI. That's all I had to know to get this far, heck, I barely just learned how to make a form! But I'd like to be more the master of my webs, so where do you recommend I begin looking at backend scripting? What language(s) are included in that? Bear with me!

Shannon

Was This Post Helpful? 0
  • +
  • -

#7 WebDevTool  Icon User is offline


Reputation: 0
  • View blog
  • Posts: -8,388,608
  • Joined: 27-February 02

Re: How do I change CELL BG IMAGE on reload

Posted 22 March 2002 - 10:24 PM

My take on the whole subject:

Anything client-side (roll overs, form validation, simple code, stuff that won't need a server or DB) should be javascript, as it is platform/browser-friendly.

You have already been given examples of different CommonGatewayInterface languages: PHP and PERL (supernova333 likes to call PERL cgi, when really PERL is PERL, and cgi is ANY type of passing information from the client back to the web-server; supernova333 don't get pissed, everyone does this).

I am a lazy dinosaur with a some VB experience, and a boss with a Win2000 server, so I picked up ASP. Not really looking forward to the whole DotNet thing, but if you don't change with the times, they'll change without you.

It all depends on what type of server you have available. Unless you want to start admin. on a server, you'll probably use what it has available on it already.

Unix servers will support PERL right out of the box. The DB that I see paired into this system is called mySQL. From everything I have read, and from the little I studied PERL, I can tell you: it's VERY cool, VERY powerful, and VERY intricate. As with any API, there's a lot to learn, where things are, syntax, etc. The learning curve is likely to be really hard compared to other cgi languages.

Then there's php. I'm a virgin, i know NOTHING about php, other than the fact that I see it all OVER the place, so the popularity has to be coming from somewhere. If you look in the php/asp/db forum you'll see a SLEW of folks nearly SCREAMING their praises of php- i forget which thread. A good sign.

ASP is a microsponge product, and is native to Win NT4 & Win 2000 servers. It can (like any cgi language for any hardware) be installed on Unix, but who WANTS to?!

*passes out from tmi*

Anyway. This could all be done with javascript on the client. Write a cookie that will count the visitor's page loads. Based upon this count, you can document.write anything you want to make the cell bg image.

I hate waiting for the server, so I write as much in javascript as I can. Plain-text is so lightweight it's almost free. Who am I kidding, you younsters all surf the CableT1DSL at a BLINDING rate of speed- am I wrong?

I could prob. send you code examples if you want.

<edit>
i just re-read this wordy Tome- volumes about NOTHING. I STINK. I should give it up and go back to dope. haha
</edit>

(Edited by WebDevTool at 12:27 am on Mar. 23, 2002)

Was This Post Helpful? 0
  • +
  • -

#8 Shannon  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 13-March 02

Re: How do I change CELL BG IMAGE on reload

Posted 23 March 2002 - 02:36 AM

Thanks WebDevTool, I would like it if you sent me the javascript code. I'm going to be learning some stuff.
Was This Post Helpful? 0
  • +
  • -

#9 WebDevTool  Icon User is offline


Reputation: 0
  • View blog
  • Posts: -8,388,608
  • Joined: 27-February 02

Re: How do I change CELL BG IMAGE on reload

Posted 23 March 2002 - 12:39 PM

OK, Shannon... here you go:

1) This javascript REQUIRES a server, but it doesn't matter what kind.

2) Works in IE5.5, NN4, & NS6 on pc. mac users gimme feedback

3) You can see a demo here: http://www.zroove.co...ool/image3.html

4) You can see the source (without tabs, sorry) here: http://www.zroove.co...mage3_code.html

5) You can download the raw, un-served source here: http://www.zroove.co...tool/image3.zip

6) I am liking lists lately ;)

7) Were you posting at 4:36 am? Really?! Or are you overseas somewhere? Good work!

-L8r

Was This Post Helpful? 0
  • +
  • -

#10 Shannon  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 13-March 02

Re: How do I change CELL BG IMAGE on reload

Posted 23 March 2002 - 04:00 PM

Yah! I checked out your example WebDevTool, that will be useful, gotta go now, but I'll return to check out the source.

7)1:36am, you must be on the East coast? I'm west.

Thank you very much.

I'm figuring that PHP and mySQl will be a good place to start for me, as I have been handed a very cool artist's community/galleries/e-commerce site to develope.

Cya

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1