View Full Version : point me in the right direction
08-02-2006, 03:56 AM
as part of the homework, we are to place 3 buttons on the page, and when you click on them, they dont take you anyplace until you click on a url link, which will take you to one of 3 places, depending on which button you click first. is this a particular type of function? do you store the 'link' to access later? and how? i would search, but dont know what to call this kind of action.:confused:
08-02-2006, 04:01 AM
are the links supposed to be visible before you click the buttons?
if so, is this what you mean?
<a id="link1" href="#">Link 1</a>
<a id="link2" href="#">Link 2</a>
<a id="link3" href="#">Link 3</a>
<input type="button" value="Button 1" onClick="changeLinks('url1','url2','url3');">
<input type="button" value="Button 2" onClick="changeLinks('url1','url2','url3');">
<input type="button" value="Button 3" onClick="changeLinks('url1','url2','url3');">
replace the bolded green texts with links for link 1, 2, and 3 for their respective buttons.
08-02-2006, 04:17 AM
my buttons are going to be called heaven, purgatory, and hell. when you click on heaven, it will 'store' the reference to apple.com, purgatory will hold linux and hell will hold ms.... but you wont go to the respective sites till you click an href link that states, click here to go to your chosen destination.... does that change anything of what you posted?
08-02-2006, 06:22 AM
<a id="link" href=""></a>
<input type="button" value="Heaven" onClick="changeLink('Click Here to go to Apple','http://apple.com/');">
<input type="button" value="Purgatory" onClick="changeLink('Click Here to go to Linux','http://linux.org/');">
<input type="button" value="Hell" onClick="changeLink('Click Here to Go to Microsoft','http://microsoft.com/');">
08-02-2006, 07:23 AM
LadyiMac bows to the buddah nature of boeing747fp. That is absolutely perfect. :thumbsup:
08-02-2006, 08:58 AM
LadyiMac, what's the point in taking that class you're taking if you have someone do your homework for you?
boeing747fp, why are the first "c"s in "onclick" capitalized when the use of "<br />" instead of "<br>" indicates you are using XHTML?
08-02-2006, 10:45 AM
i always put onClick.... is there really a difference between onclick and onClick ??
08-02-2006, 08:18 PM
Yes. XHTML is case-sensitive. In XHTML, there is no such thin as "onClick", but "onclick" does exist.
It's bad practice to use inline event handlers.
I suggest you both read these:
Behavioral Separation (http://www.alistapart.com/articles/behavioralseparation/)
DOM Scripting - Sample chapter: Best Practices (http://www.domscripting.com/book/sample/)
Accessible DHTML (http://www.severnsolutions.co.uk/articles/001/)
08-03-2006, 12:55 AM
well... i dont really know the difference between html and xhtml or whatever.... dreamweaver does <br /> so who knows... and i just wrote a quick code based on what she wanted done (with Buttons)... and just wondering.... why does XHTML not allow onClick yet it works in the browsers?
08-03-2006, 05:18 AM
Until you learn the many differences stick with HTML and "<br>".
One of XHTML's rules is that all element and attribute names must be in lower-case. (http://www.w3.org/TR/xhtml1/#h-4.2)
Unless you're using DreamWeaver 8, you should find a new text editor.
08-03-2006, 04:54 PM
yea im using dw 8... thanks for those documentations... i'll study up on that stuff.