codetoad.com
  ASP Shopping Cart, Forum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  problem hiding form elements with function and link  DoctorGonzo at 11:42 on Tuesday, June 14, 2005
 

Hi guys,

I am trying to hide a form element with the ID "question1" and display a form element called "question2" (both of these are tables) with a link and function - but it is not working - thus: (I am getting "syntax error" in my javascript alert)

This is my link :

<a href=javascript:nextQuestion(question1, question2)>Next Question</a>

function nextQuestion(last, next){
last.style.display="none";
next.style.display="block";
}

I have tried passing the 2 elements in the brackets both with and without quotes.... can anyone please advise?

I want to use this function over and over, passing different elemnts as the quiz progresses.

Many thanks as always!!

Gonzo

  Re: problem hiding form elements with function and link  Troy Wolf at 16:31 on Tuesday, June 14, 2005
 

Try this:

<script language="javascript">
function nextQuestion(last, next){
document.getElementById(last).style.display="none";
document.getElementById((next).style.display="block";
}
</script>

<a href="javascript:nextQuestion('question1', 'question2')">Next Question</a>
Troy Wolf: site expert
SnippetEdit Website Editor


  Re: problem hiding form elements with function and link  DoctorGonzo at 16:24 on Thursday, June 16, 2005
 

Hi troy.

many thanks

the problem was I had put a space between the 2 elements that I was passing to the function!

Gonzo








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  matrix addition
•  Re: Storing data from HTML to Excel or TXT
•  Re: function within loop problem
•  Re: Ô‡´ò¥¯¥é¥Ö¤Ã� ¥Æ©`¥é©`¥á¥¤¥É£ò£±£±¥¢¥¤¥¢¥ó ¤Î£··¬ ¤Ç¤¹
•  Re: Replace
•  Re: タイトリスト AP2アイアン 712ã�®æƒ…å �
•  Re: SMS from Perl using HTTP request
•  Re: Charl Schwartzel
•  Re: Adhyayan - Annual Student Conference and Online Coding Festival


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2013