Hello and welcome to the Webmasters Forums!. This is the best place to get webmasters resources for free. Get $2 for free today, read more - Make your payment today. Download premium and professional templates for free. Get free web hosting without ads, read more. You can get lot more by simply join with this forum. To gain full access to the forums you must sign up for a free account.


Post Reply  Post Thread 

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)
Post: #1

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? Shy


MyBB.ro|Extra.animezup.com|Picture with me ^^|Animezup.com|Forum.animezup.com|Manga-anime.ro|My blog^^
05-08-2007 10:39 PM
Visit this user's website Find all posts by this user Quote this message in a reply
ivenms
Administrator
*******


Posts: 2,177
Group: Administrators
Joined: Sep 2006
Status: Offline
Reputation: 14
Points: 4389 (Donate)
Post: #2

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:

Code:
<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
Find all posts by this user Quote this message in a reply
Cedik
Moderator
*****


Posts: 424
Group: Moderators
Joined: Aug 2007
Status: Away
Reputation: 2
Points: 575 (Donate)
Post: #3

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 Big Grin
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:

Code:
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
Visit this user's website Find all posts by this user Quote this message in a reply
ivenms
Administrator
*******


Posts: 2,177
Group: Administrators
Joined: Sep 2006
Status: Offline
Reputation: 14
Points: 4389 (Donate)
Post: #4

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
Find all posts by this user Quote this message in a reply
Cedik
Moderator
*****


Posts: 424
Group: Moderators
Joined: Aug 2007
Status: Away
Reputation: 2
Points: 575 (Donate)
Post: #5

RE: I would like to make a simple html page with a dynamic content using java script


I guess you're right! I didn't think of that! And it was quite obvious. Thanks a lot, Ivenms! I owe you one!


MyBB.ro|Extra.animezup.com|Picture with me ^^|Animezup.com|Forum.animezup.com|Manga-anime.ro|My blog^^
06-08-2007 02:41 AM
Visit this user's website Find all posts by this user Quote this message in a reply
Troy
Newbie


Posts: 6
Group: Registered
Joined: Aug 2007
Status: Offline
Reputation: 0
Points: 26 (Donate)
Post: #6

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
Find all posts by this user Quote this message in a reply
ivenms
Administrator
*******


Posts: 2,177
Group: Administrators
Joined: Sep 2006
Status: Offline
Reputation: 14
Points: 4389 (Donate)
Post: #7

RE: I would like to make a simple html page with a dynamic content using java script


But html is more search engine friendly.

One more thing, JavaScripts are usually not indexed by search engines.


Read: General Rules & Policies before posting.
Make Money By Posting | Earning and Exchanging Points | Add Your Links
06-08-2007 10:40 AM
Find all posts by this user Quote this message in a reply
Cedik
Moderator
*****


Posts: 424
Group: Moderators
Joined: Aug 2007
Status: Away
Reputation: 2
Points: 575 (Donate)
Post: #8

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
Visit this user's website Find all posts by this user Quote this message in a reply
ivenms
Administrator
*******


Posts: 2,177
Group: Administrators
Joined: Sep 2006
Status: Offline
Reputation: 14
Points: 4389 (Donate)
Post: #9

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
Find all posts by this user Quote this message in a reply
Dhanraj
Senior Member
****


Posts: 272
Group: Registered
Joined: Aug 2007
Status: Offline
Reputation: 1
Points: 99 (Donate)
Post: #10

RE: I would like to make a simple html page with a dynamic content using java script


people nowadays are too busy,they dont like heavy graphic contents except the beneficial ones.so making a site with limited graphics is adequate.


Free cash for surveys

Our Great indian forum

Pretty good PTC-Real

Anonymize your links
11-09-2007 02:47 PM
Visit this user's website Find all posts by this user Quote this message in a reply
ivenms
Administrator
*******


Posts: 2,177
Group: Administrators
Joined: Sep 2006
Status: Offline
Reputation: 14
Points: 4389 (Donate)
Post: #11

Which sites Need simple design to increase loding speed


Dhanraj Wrote:
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
Find all posts by this user Quote this message in a reply
Post Reply  Post Thread 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Help with php upload script spartan 12 339 23-11-2007 05:41 AM
Last Post: Lord_Daksh
  Tutorial on making a custom 404 error page Dhanraj 13 520 29-10-2007 03:04 AM
Last Post: ivenms
  Add New Content Effortlessly to Your Website with RSS Feeds ivenms 3 568 23-09-2007 01:49 AM
Last Post: Pirate King
Sad PROMPT NAME ON START(javascript),IN A HTML PAGE. Plz help,its not working 4me! Lord_Daksh 8 350 22-09-2007 05:39 AM
Last Post: Lord_Daksh
Cool A simple text hit counter [ ASP ] yupfy45 4 834 25-07-2007 08:20 PM
Last Post: walsh

View a Printable Version
Send this Thread to a Friend
Subscribe to this Thread | Add Thread to Favorites
Rate This Thread:

Forum Jump:

Sign In to Remove Ads

Download 1000's of web templates. Unlimited access!
World's Best Web Hosting
Resources

Recommended Sites:



Visit our Sponsors!

Current time: 22-11-2008, 02:30 AM


Copyright © 2002-2008 MyBB Group
Powered By MyBB