User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 427,095 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,299 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1067 | Replies: 7
Reply
Join Date: Apr 2006
Posts: 14
Reputation: Ries is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Ries Ries is offline Offline
Newbie Poster

javascript:show('newsmsgid');

  #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?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2004
Posts: 1,590
Reputation: tgreer is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 35
Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: javascript:show('newsmsgid');

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

Re: javascript:show('newsmsgid');

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

Re: javascript:show('newsmsgid');

  #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  
Join Date: Apr 2006
Posts: 14
Reputation: Ries is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
Ries Ries is offline Offline
Newbie Poster

Re: javascript:show('newsmsgid');

  #5  
Jul 11th, 2006
So it would be?
<a href="javascript:show('news1');">Welcome</a><br>
<div id="news1">
welcome to the site
</div>
Reply With Quote  
Join Date: May 2006
Location: Nigeria, West Africa
Posts: 20
Reputation: havilah is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
havilah's Avatar
havilah havilah is offline Offline
Newbie Poster

Re: javascript:show('newsmsgid');

  #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  
Join Date: Dec 2004
Posts: 1,590
Reputation: tgreer is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 35
Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: javascript:show('newsmsgid');

  #7  
Jul 11th, 2006
Originally Posted by Ries
So it would be?
<a href="javascript:show('news1');">Welcome</a><br>
<div id="news1">
welcome to the site
</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  
Join Date: Dec 2004
Posts: 1,590
Reputation: tgreer is an unknown quantity at this point 
Rep Power: 7
Solved Threads: 35
Colleague
tgreer tgreer is offline Offline
Made Her Cry

Re: javascript:show('newsmsgid');

  #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  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JavaScript / DHTML / AJAX Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 5:22 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC