|
I would like to make a simple html page with a dynamic content using java script
|
Post Bank
Posting Manager
     
Posts: 995
Group: Forum Team
Joined: Sep 2006
Status: Online
|
Make money from now. You can make money just for posting on this forum. Every discussions on this community gives you more money. $2 minimum payout. So get your payment today, SignIn with this forum.
Signin to Remove this Post
|
|
|
|
Cedik
Moderator
    
Posts: 424
Group: Moderators
Joined: Aug 2007
Status:
Away
Reputation: 2
Points: 575 (Donate)
|
I would like to make a simple html page with a dynamic content using java script
As this thread's title says, I would like to make a html page with a dynamic content.. so to say...
The idea is simple, I would like to have instead of an index page for my site, an html page that would contain a picture that would send me to the actual index.php. The whole idea is that I would like that picture to be different anytime you enter the site. Something like the random quotes script posted here by Ivenms.
Now, I do not ask for someone to do it for me, since I would like to learn some java myself. Instead, I would appreciate if someone could tell me what functions or commands I should use for this so I wouldn't have to start learning java script from zero until I'll reach this stage. I mention that I am not a beginner when it comes to programming in general, I know the basics and the way of thinking so I wouldn't need something like an absolute beginners guide on how to do it. In fact, I already think that I can make something like this by just modifying Ivenms random quote script but I need to know a few more things first... So? Can anyone help me?
MyBB.ro|Extra.animezup.com|Picture with me ^^|Animezup.com|Forum.animezup.com|Manga-anime.ro|My blog^^
|
|
| 05-08-2007 10:39 PM |
|
|
ivenms
Administrator
      
Posts: 2,179
Group: Administrators
Joined: Sep 2006
Status:
Offline
Reputation: 14
Points: 4389 (Donate)
|
Make a simple html page with a dynamic content using java script
You can simply make a picture entering page with the random quote script.
First make an array of size NUM which is equal to the number of pictures you have.
Then initialize each array with the image name of pictures you have.
Then include another codes given on the random quote script.
I am making here a demo script for yourself:
<script language="JavaScript">
pics = new Array(3);
pics[0] = "picture1.jpg";
pics[1] = "picture2.jpg";
pics[2] = "picture3.jpg";
index = Math.floor(Math.random() * pics.length);
document.write("<img src='" + pics[index] + "'>");
</script>
Just embed this on the region where you want to show your image.
Read: General Rules & Policies before posting.
Make Money By Posting | Earning and Exchanging Points | Add Your Links
|
|
| 06-08-2007 12:13 AM |
|
|
Cedik
Moderator
    
Posts: 424
Group: Moderators
Joined: Aug 2007
Status:
Away
Reputation: 2
Points: 575 (Donate)
|
RE: I would like to make a simple html page with a dynamic content using java script
Ok, this I understand. It declares a number of pics, then I uses a random function to "print" one of them. It makes sense
Bot how do I make it send me to a certain adress when I click the picture?
Should I insert something like "a href=" in the document.write?
Something like:
document.write("<img src='" +"a href="http://mysite.com/index.php"+ pics[index] + "'>");
I guess it should be something similar...
MyBB.ro|Extra.animezup.com|Picture with me ^^|Animezup.com|Forum.animezup.com|Manga-anime.ro|My blog^^
|
|
| 06-08-2007 01:51 AM |
|
|
ivenms
Administrator
      
Posts: 2,179
Group: Administrators
Joined: Sep 2006
Status:
Offline
Reputation: 14
Points: 4389 (Donate)
|
RE: I would like to make a simple html page with a dynamic content using java script
Every pics leads to one place. Isn't it?
If so, then you just want to embed the javascript with in the anchor tags on the HTML page.
That's all. You can find links on your images. No need for editing the script. If it is not working, reply here with the details.
Read: General Rules & Policies before posting.
Make Money By Posting | Earning and Exchanging Points | Add Your Links
|
|
| 06-08-2007 02:16 AM |
|
|
Cedik
Moderator
    
Posts: 424
Group: Moderators
Joined: Aug 2007
Status:
Away
Reputation: 2
Points: 575 (Donate)
|
|
| 06-08-2007 02:41 AM |
|
|
Troy
Newbie
Posts: 6
Group: Registered
Joined: Aug 2007
Status:
Offline
Reputation: 0
Points: 26 (Donate)
|
RE: I would like to make a simple html page with a dynamic content using java script
Couldn't you use PHP to generate the picture for the main page. Then it would work even if people had JavaScript disabled.
Be a part of the
Free Website Project
Join Today!
|
|
| 06-08-2007 09:48 AM |
|
|
ivenms
Administrator
      
Posts: 2,179
Group: Administrators
Joined: Sep 2006
Status:
Offline
Reputation: 14
Points: 4389 (Donate)
|
|
| 06-08-2007 10:40 AM |
|
|
Cedik
Moderator
    
Posts: 424
Group: Moderators
Joined: Aug 2007
Status:
Away
Reputation: 2
Points: 575 (Donate)
|
RE: I would like to make a simple html page with a dynamic content using java script
Well, in the end I decided to do something else. Instead of having an picture as an index page, I decided to make a custom block in the middle of my portal ( MKPortal) that shows me an random image every time someone enters the portal. It has the same effect after all and I won't have any problems with the search engine bots. Nice, huh?
And thanks again for the help, Ivenms. If you want to check out how it turned, click here.
MyBB.ro|Extra.animezup.com|Picture with me ^^|Animezup.com|Forum.animezup.com|Manga-anime.ro|My blog^^
|
|
| 09-08-2007 05:22 AM |
|
|
ivenms
Administrator
      
Posts: 2,179
Group: Administrators
Joined: Sep 2006
Status:
Offline
Reputation: 14
Points: 4389 (Donate)
|
RE: I would like to make a simple html page with a dynamic content using java script
Yes..
That is better idea. I don't like the site with entry pages. Now days, every one visiting on the web pages are busy. They don't want to waste their time viewing useless entry pages.
Also you managed to make a good template structure. Also placed the picture very properly. Great work on there.
Read: General Rules & Policies before posting.
Make Money By Posting | Earning and Exchanging Points | Add Your Links
|
|
| 09-08-2007 06:38 AM |
|
|
Dhanraj
Senior Member
   
Posts: 272
Group: Registered
Joined: Aug 2007
Status:
Offline
Reputation: 1
Points: 99 (Donate)
|
|
| 11-09-2007 02:47 PM |
|
|
ivenms
Administrator
      
Posts: 2,179
Group: Administrators
Joined: Sep 2006
Status:
Offline
Reputation: 14
Points: 4389 (Donate)
|
Which sites Need simple design to increase loding speed
people nowadays are too busy,they dont like heavy graphic contents except the beneficial ones.so making a site with limited graphics is adequate.
That depends upon the site category..
If the site is an informative site, cutoff the graphics as much as possible and increase the load time.
But if the site is some like cartoon site or fun site, they need some images that lights up the site's design. Sites residing on these category expects visits from minors and minors normally interested in designs and graphics.
Read: General Rules & Policies before posting.
Make Money By Posting | Earning and Exchanging Points | Add Your Links
|
|
| 11-09-2007 05:28 PM |
|
|