javascript:show('newsmsgid');

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Apr 2006
Posts: 20
Reputation: Ries is an unknown quantity at this point 
Solved Threads: 0
Ries Ries is offline Offline
Newbie Poster

javascript:show('newsmsgid');

 
0
  #1
Jul 10th, 2006
On a website I remeber seeing a news feature where the news would be a bar with a title and you clicked it and it would expand showing the message and other information and the code used was javascript:show but I don't understand how it works (as the news was got from a mysql database) how would this be done?
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 1,655
Reputation: tgreer is an unknown quantity at this point 
Solved Threads: 35
Team Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: javascript:show('newsmsgid');

 
0
  #2
Jul 11th, 2006
Which part of your giant sentence do you need further help on?
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 20
Reputation: Ries is an unknown quantity at this point 
Solved Threads: 0
Ries Ries is offline Offline
Newbie Poster

Re: javascript:show('newsmsgid');

 
0
  #3
Jul 11th, 2006
I want to now how to code something like that so i can make expanding stuff.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 1,655
Reputation: tgreer is an unknown quantity at this point 
Solved Threads: 35
Team Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: javascript:show('newsmsgid');

 
0
  #4
Jul 11th, 2006
You do just what you said: have server-side code perform a query or stored procedure, render the results in a DIV, and toggle the visibility of that div using JavaScript.

Again, which part do you have a question about?
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 20
Reputation: Ries is an unknown quantity at this point 
Solved Threads: 0
Ries Ries is offline Offline
Newbie Poster

Re: javascript:show('newsmsgid');

 
0
  #5
Jul 11th, 2006
So it would be?
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <a href="javascript:show('news1');">Welcome</a><br>
  2. <div id="news1">
  3. welcome to the site
  4. </div>
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 20
Reputation: havilah is an unknown quantity at this point 
Solved Threads: 0
havilah's Avatar
havilah havilah is offline Offline
Newbie Poster

Re: javascript:show('newsmsgid');

 
0
  #6
Jul 11th, 2006
You said the result should be rendered in a Div, what I replace the "Div" with a "tr" tag?
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 1,655
Reputation: tgreer is an unknown quantity at this point 
Solved Threads: 35
Team Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: javascript:show('newsmsgid');

 
0
  #7
Jul 11th, 2006
Originally Posted by Ries
So it would be?
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
  1. <a href="javascript:show('news1');">Welcome</a><br>
  2. <div id="news1">
  3. welcome to the site
  4. </div>
That would be the HTML part of it, yes.

Then, you'll need CSS assigned to the DIV in order to make it initially invisible.

You'll need to write a JavaScript function named "show", which accepts the ID of the div and changes the style to "visible".

You'll need the server-side code to retrieve "welcome to the site" from a database and write the above output.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 1,655
Reputation: tgreer is an unknown quantity at this point 
Solved Threads: 35
Team Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: javascript:show('newsmsgid');

 
0
  #8
Jul 11th, 2006
Originally Posted by havilah
You said the result should be rendered in a Div, what I replace the "Div" with a "tr" tag?
Then you would get a badly broken HTML fragment. You really don't want elements that will have their display and/or visibility properties dynamically changed, within a table.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC