/    Sign up×
Community /Pin to ProfileBookmark

OnClick Load

[B]Thanks: [/B]I have had some marvelous help on these forums and have went from knowing nothing at all to putting together some of my first scripts by myself, so i just wanted to say thank you to everyone who spends time helping!

[B]Problem:[/B] I have been trying to figure out how to do something, and I don’t even know if its possible. I want the table in my example below, to NOT load when the page loads. When the user clicks on Submit I want the table to load.

If thats not possible is it possible to keep the image from loading untill onlick of the submit button? Can anyone demonstrate how I would, if at all possible, go about this?

[B]Note:[/B] I do not want the table (or image) to just be hidden, I want it to not load at all untill the Submit button has been clicked.

[CODE]<form><input type=”submit” value=”Submit” name=”B7″>
</form>

<table border=”1″ id=”t7″>

<td width=”100%”><img border=”0″ src=”http://www.google.com/intl/en_ALL/images/logo.gif” width=”276″ height=”110″></td>

</table>[/CODE]

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@JMRKERFeb 20.2008 — I'm not sure I understand why the table should not be seen until the submit is clicked,

but you could load the table into a <div> tag and then show/hide it based on another button.

Alternate idea: Load the table into a page to display after the submit is clicked (?).
Copy linkTweet thisAlerts:
@LeonsbuddydaveFeb 21.2008 — This is what I have so far, but for some reason it re-hides itself right afterwards. Hmm..

EDIT: Wait, I just read that you don't want it to load at all? Well, I don't think that's possible with JS, but maybe you could figure something out with a server side language? I'm not very good at PHP, so I don't know.
<i>
</i>&lt;style type="text/css"&gt;
#table {
border: 0;
}
&lt;/style&gt;
&lt;script language="javascript" type="text/javascript"&gt;
function showTable() {
document.getElementById("table").style.display = "block";
}
function hideTable() {
document.getElementById("table").style.display = "none";
}

window.onload = hideTable;
&lt;/script&gt;
&lt;form&gt;&lt;input type="submit" value="Submit" name="B7" onClick="showTable()"&gt;
&lt;/form&gt;




&lt;div id="table"&gt;
&lt;table border="1" id="t7"&gt;

<i> </i>&lt;td width="100%"&gt;&lt;img border="0" src="http://www.google.com/intl/en_ALL/images/logo.gif" width="276" height="110"&gt;&lt;/td&gt;

&lt;/table&gt;
&lt;/div&gt;
×

Success!

Help @rabit spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...