HTML problem
2 posters
Page 1 of 1
HTML problem
I just wanted to add a little random function to my forum.
There should be a lot of differt possibilities, but my code don't work.
But it works in a normal browser, but not as a portal widget...
Anyway, here is the code:
Pls help me!
BTW: It should display a picture with a link to google and a little text below.
There should be a lot of differt possibilities, but my code don't work.
But it works in a normal browser, but not as a portal widget...
Anyway, here is the code:
- Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<html>
<head>
<script type="text/javascript" language="JavaScript">
<!--
var Anzahl = 7; // Anzahl der Bilder
var ZufallJetzt = new Date()
var ZufallsZahl = ZufallJetzt.getSeconds() % (Anzahl);
// Zuweisungen abhängig von der Zufallszahl
if (ZufallsZahl==0) {
TextFarbe = "#C04000";
GrafikUrl = "http://g.imagehost.org/0410/get_aspx.jpg";
UnterTitel="Natural Boost"
Link = "http://www.google.de"
}
if (ZufallsZahl==1) {
TextFarbe="#00BF00";
GrafikUrl = "http://g.imagehost.org/0145/get_aspx.jpg";
UnterTitel="Alpine > Dream"
Link = "http://www.google.de"
}
if (ZufallsZahl==2) {
TextFarbe="#00A050";
GrafikUrl = "http://g.imagehost.org/0515/get_aspx.jpg";
UnterTitel="Rolling Hills"
Link = "http://www.google.de"
}
if (ZufallsZahl==3) {
TextFarbe="#DF0000";
GrafikUrl = "http://g.imagehost.org/0991/get_aspx.jpg";
UnterTitel="Burn the Rubber"
Link = "http://www.google.de"
}
if (ZufallsZahl==4) {
TextFarbe="#9000E0";
GrafikUrl = "http://g.imagehost.org/0627/get_aspx.jpg";
UnterTitel="StaMetrical"
Link = "http://www.google.de"
}
if (ZufallsZahl==5) {
TextFarbe="#9000E0";
GrafikUrl = "http://g.imagehost.org/0394/get_aspx.jpg";
UnterTitel="[FS] NoBoost"
Link = "http://www.google.de"
}
if (ZufallsZahl==6) {
TextFarbe="#0070C0";
GrafikUrl = "http://g.imagehost.org/0679/get_aspx.jpg";
UnterTitel="Dead Island!"
Link = "http://www.google.de"
}
function Zufallsbild01() {
document.write("<a href=" + Link + "><img src='" + GrafikUrl+ "' width='320' height='240' border='1' alt='Texxxt'></a><br>")
document.write("<font color='" + TextFarbe +"'>" + UnterTitel + "</font><br>")
return
}
// -->
</script>
</head>
<body>
<div align="center">
<script type="text/javascript" language="JavaScript">
<!--
Zufallsbild01();
//-->
</script>
</div>
<br><br>
</body>
</html>
Pls help me!
BTW: It should display a picture with a link to google and a little text below.
Re: HTML problem
May I remind you that double/triple posting isn't tolerated unless separated by 24 hours (Use the edit button)
Sanket- ForumGuru
- Posts : 48766
Reputation : 2830
Language : English
Location : Mumbai
Re: HTML problem
A portal widget cannot have head & body tags, its for a whole html page.
Sanket- ForumGuru
- Posts : 48766
Reputation : 2830
Language : English
Location : Mumbai
Re: HTML problem
I am not sure if it will work. Sorry.
Sanket- ForumGuru
- Posts : 48766
Reputation : 2830
Language : English
Location : Mumbai
Re: HTML problem
Are you looking for the code to follow you down the screen when you scroll down, The image with link then would be 'Floating', Is that what your aiming for?
regards
Craig
regards
Craig
Guest- Guest
Re: HTML problem
Double post but not intentional
Try this code out
In the head of the page add the following:
In the body of the page (Where you want the images to show) add the following code:
The above codes worked on my test site modules
Regards
Craig
Try this code out
In the head of the page add the following:
- Code:
<script language="JavaScript">
<!-- Hide from old browsers
iArray=new Array
(
"images.jpg",
"images.jpg",
"images.jpg",
"images.jpg",
"images.jpg",
"images.jpg",
"images.jpg",
"images.jpg",
"images.jpg",
"images.jpg"
);
ri=Math.floor(iArray.length*Math.random());
ri='<IMG SRC="./'+ iArray[ri]+ '" BORDER="1">';
// end hiding -->
</script>
In the body of the page (Where you want the images to show) add the following code:
- Code:
<script language="JavaScript">
<!--
document.write(ri);
// -->
</script>
The above codes worked on my test site modules
Regards
Craig
Guest- Guest
Re: HTML problem
Now it works!!
I had to remove the comments, they made it not work...
So now, first of all thank you.
I'm the happiest person on the world now.
-thread closed- (in my eyes)
I had to remove the comments, they made it not work...
So now, first of all thank you.
I'm the happiest person on the world now.
-thread closed- (in my eyes)
Re: HTML problem
Since this thread appears to be solved, I will lock this thread and mark it as solved.
Sanket
Sanket
Sanket- ForumGuru
- Posts : 48766
Reputation : 2830
Language : English
Location : Mumbai
Similar topics
» Scripts Problem or html Problem
» HTML Problem & Signature Problem
» HTML PROBLEM !
» Please help with little HTML problem.
» html problem
» HTML Problem & Signature Problem
» HTML PROBLEM !
» Please help with little HTML problem.
» html problem
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum