Help - Search - Members - Calendar
Full Version: multiple events onclick
HTMLHelp Forums > Web Authoring > General Web Design
htmlj
I'm new to this - What is the correct syntax to combine 2 events in on single button click?

The first button is:

<input class="submit-button" type="submit" name="next" value="Next" onclick="document.PdcSurvey.PdcButtonPressed.value='next';" />


The second button is:

<li><a href="http://www.google.com/ig?hl=en" target="_blank">Next Page>></a></li>

From searching the web, it sounds like it can be done. But I can't get the syntax correct.

Thanks in advance.
pandy
The second one is an ordinary link. It doesn't have an onclick. So just move the onlick there.

CODE
<a href="http://..." onclick="...">


If you really have two JS snippets you want to run with the same event, you can just list them. Don't forget to finish each statement with a semicolon though.

CODE
<p onclick="doThis();doThat();">
htmlj
Yes, the one is just an ordinary link. So.... I can't get the syntax just right. So with the above example that I listed, how would you do the coding. (with your first example) If I understand you correctly, since it is just an ordinary link, I don't have to do an onclick.

I want the user to click the button & it does

First: <input class="submit-button" type="submit" name="next" value="Next" onclick="document.PdcSurvey.PdcButtonPressed.value='next';" />

Last: <li><a href="http://www.google.com/ig?hl=en" target="_blank">Next Page>></a></li>

Submits & then opens a new browser tab.

Sorry, I am still really new to this. Just need help with this syntax.

Thanks!

==============================================


QUOTE(pandy @ Nov 3 2009, 06:20 PM) *

The second one is an ordinary link. It doesn't have an onclick. So just move the onlick there.

CODE
<a href="http://..." onclick="...">


If you really have two JS snippets you want to run with the same event, you can just list them. Don't forget to finish each statement with a semicolon though.

CODE
<p onclick="doThis();doThat();">


This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.