Go Back   Forums > Community Chatterbox > Tech Corner > Programming
Memberlist Forum Rules Today's Posts
Search Forums:
Click here to use Advanced Search

Reply
 
Thread Tools Display Modes
Old 09-02-2006, 01:33 PM   #1
swiss
who's not Swiss
 
swiss's Avatar

 
Join Date: Jun 2005
Location: Velen, Germany
Posts: 711
Default

Hey guys,

I need two scripts for a homepage I am currently changing. It is completely based on Perl, PHP, JavaScript and HTML. There is nothing I can change about the base-scripting...

1.
I want to have a dynamic "hint of the day"-thingy. Everytime the page is loaded (or reloaded) another hint should appear on the page. The hints could probably be stored in a CSV-File and the HTML Code must include something like "pic a random hint and display it on the page". Can anyone help me with that ? I would be probably enough to know how to generate a random number between 1 and 30 in PHP or alike and how to read item number *whatever* of the CSV-File.


2.
I have a dynamically generated page with a radiobutton called "_lowres vakue=0" and another called "_lowres value=1 checked". Now I need a script or something that can be put beneath the dynamic call that changes the property of button 1 to checked and button 2 to - well - nothing. Like this:

Current page:
<input type=radio name=_lowres value=0>Layoutbild

<input type=radio name=_lowres value=1 checked>Feinbild


That's what I want it to be:
<input type=radio name=_lowres value=0 checked >Layoutbild

<input type=radio name=_lowres value=1>Feinbild


is there a call like "set property of button "_lowres value=0" to checked" (that's how it would work with AppleScript ....

Thank a lot in advance!!!!!

Cheers,


swiss
swiss is offline                         Send a private message to swiss
Reply With Quote
Old 09-02-2006, 01:40 PM   #2
Mara
Abandonia nerd

 
Join Date: Jan 2006
Location: ,
Posts: 93
Default

to change to property of a buton -> Java script.

try something like

GetElementById('ButonName').value= wathever you want to change the value to.

I'm not sure about the prober syntax, so google for it
Mara is offline                         Send a private message to Mara
Reply With Quote
Old 09-02-2006, 02:33 PM   #3
Rogue
10 GOSUB Abandonia
20 GOTO 10
 
Rogue's Avatar

 
Join Date: Nov 2004
Location: Afrim, Albania
Posts: 2,113
Default

Both of those things should be done with java scripts.

Long time ago I coded something simillar to hint thing. It sould be simple to code.
Rogue is offline                         Send a private message to Rogue
Reply With Quote
Old 09-02-2006, 03:11 PM   #4
plix
Game freak

 
Join Date: Oct 2005
Location: ,
Posts: 113
Default

Regardless of the style of the file, you'll want to end up with an array of hints. Then it's as simple as
Code:
$array[mt_rand(0,count($array))];
(mt_rand() is better than the old rand(), but the latter would still work).

For your second problem Mara's suggestion isn't quite right. If you wish to use the DOM (as that example does, though it precludes older browsers), then what you want is actually more along the lines of
Code:
document.getElementById('id_attribute_value_of_the_radio_button').checked = true
though this would require that you set a unique ID for each of the radio buttons. I'll leave the actual placement of that statement as an excercise for the reader.
plix is offline                         Send a private message to plix
Reply With Quote
Old 09-02-2006, 08:21 PM   #5
Eagle of Fire
Friendly Fire
 
Eagle of Fire's Avatar

 
Join Date: Sep 2004
Location: Valleyfield, Canada
Posts: 4,892
Default

Java and flash are evil. I always have them disabled by default, and I enable java only on trusted sites. I never enable flash, so I never visit sites with flash animations.
__________________
I'm on a hot streak... Literally.
Proud member of The Abandoned since 2005.
Eagle of Fire is offline                         Send a private message to Eagle of Fire
Reply With Quote
Old 09-02-2006, 09:03 PM   #6
Kon-Tiki
[BANNED]

 
Join Date: Sep 2004
Location: Dentergem, Belgium
Posts: 1,811
Default

They're not evil, just misused most of the time. Especially in Flash-banners. Those Crazy Frog flashbanners that start to go ARRRRRRRRRRRINGGGGGGDINGGGGDINNGGGGDINGGGDONGGGGGD ONNNGGGDONNNNNNGGGDOONNGGGGGGGG etc the moment the tip of your mouse goes over it, are a pain in the behind, especially when you're listening to music. They just won't stop. I've had them go on even after closing the page :blink: There's also a Flash-banner 'bout smilies, that yells "SAY SOMETHIN'" whenever you hover over it. Big pain in the behind as well. Flash's also a pain if it's used for bad design, but you can make awesome things for it, and it can be used for great stuff. Same goes for Java, but that's simply not as much something for on the 'net.
Kon-Tiki is offline                         Send a private message to Kon-Tiki
Reply With Quote
Old 09-02-2006, 09:33 PM   #7
plix
Game freak

 
Join Date: Oct 2005
Location: ,
Posts: 113
Default

He, however, was asking a question about JavaScript (aka EMCAScript) which is not at all like Java and quite a bit different from Flash.
plix is offline                         Send a private message to plix
Reply With Quote
Old 11-02-2006, 07:55 AM   #8
swiss
who's not Swiss
 
swiss's Avatar

 
Join Date: Jun 2005
Location: Velen, Germany
Posts: 711
Default

the random quote thing is solved. I got aPHP script. that's enough for the moment.

I am just wondering about this:

Code:
document.getElementById('id_attribute_value_of_the_radio_button').checked = true
The buttons name is used twice: _lowres value=0 and _lowres value=1

so is there a chance for me ?

sorry for all these n00b questions
swiss is offline                         Send a private message to swiss
Reply With Quote
Old 11-02-2006, 09:57 AM   #9
Mara
Abandonia nerd

 
Join Date: Jan 2006
Location: ,
Posts: 93
Default

two buttons = two names (unless they are radio buttons in a "one choise only" case )
Mara is offline                         Send a private message to Mara
Reply With Quote
Old 11-02-2006, 03:57 PM   #10
swiss
who's not Swiss
 
swiss's Avatar

 
Join Date: Jun 2005
Location: Velen, Germany
Posts: 711
Default

Quote:
Originally posted by Mara@Feb 11 2006, 11:57 AM
two buttons = two names (unless they are radio buttons in a "one choise only" case )
it is exactly like that ....

can't I make a Script telling the browser to do "tab, tab, tab, spacebar" ? that would result in the same thing ...
swiss is offline                         Send a private message to swiss
Reply With Quote
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
Html Calendar Nick Programming 2 15-10-2006 07:54 AM
More Html Help Bobbin Threadbare Tech Corner 29 14-03-2006 02:33 PM
Html Question Kon-Tiki Programming 21 19-02-2006 01:08 AM
How To Use Java Vm In Windows Xp? The Fifth Horseman Tech Corner 19 27-07-2005 10:29 PM
Java Kon-Tiki Tech Corner 50 13-12-2004 12:19 AM


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump
 


The current time is 10:06 PM (GMT)

 
Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.