I am pretty new at this whole scripting thing, and I was wondering if someone would kind enough to help on this problem.
I want to be able to have an html page that expands when you push a button (has some data, then when you push the button, displays more web data below the data already there). My thoughts on this was to have a perl variable controlling an 'if' loop that would start more html code for the second part. I used a javascript to try and change the perl variable, but I'm not sure I can change the perl variable in my javascript, thus even when clicking the button, the second part doesn't appear.
JavaScript:
function addstuff(){
$change="true";
}
Calling the Script:
<input type=button value="Add second part" onClick="addstuff()">
Second Part:
if(change eq "true"){
print <<EndHTML;
<html>
<body>
SUCCESS! You are a genius!
</body>
</html>
EndHTML
(Simplified)
What can I do?
Thanks in advance,
Drewser
If showing (& hiding) content in a single html page is the only thing you want to do you may put too much effort into using perl for that purpose.
Maybe you want to check out this thread [webmasterworld.com...] to learn how it can be done easier on the client/webbrowser's side using Javascript and CSS.
regards
waldemar
I want to be able to have an html page that expands when you push a button.
Just a bit of clarification there .. what do you mean by "expands" .. do you mean to say that when you click a button .. it should submit some data back to the server .. and bring new content on the page?
I know it would be easier to make it a separate form or have it all on one page with user filling out what is necessary, but my team wants this specific feature of hiding part of the form until the user really needs it.
Expanding here means that I don't want to submit any data to the server yet, just bring up extra fields to fill in.
Perl comes into play only on the server side. What you are trying to do is purely on the client side .. so perl has nothing to do with that.
As DrDoc has suggested JavaScript and CSS can be used to hide/show stuff on client side.
As for perl, I vaguely remember some way of using the CGI.pm module to do something similiar to what I need, but am having trouble getting started.