LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 01-24-2004, 08:41 PM   #1
d4d4n9
Member
 
Registered: Oct 2003
Distribution: Mandrake 10.1, Knoppix 3.7
Posts: 153

Rep: Reputation: 30
Javascript : <div>


Hi all,
I do not sure whether this question is out of place
How come any <div> tags could not be rendered in konqueror or mozilla ?
I have some html pages, but they failed to be rendered correctly by browsers in MDK9.2. Any ways to avoid this ?
Thanks in advance.

Amri
 
Old 01-25-2004, 08:59 AM   #2
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
Javascript and DIVs are not really that closely connected - perhaps you could give an example of what you are trying to do.
 
Old 01-25-2004, 06:49 PM   #3
d4d4n9
Member
 
Registered: Oct 2003
Distribution: Mandrake 10.1, Knoppix 3.7
Posts: 153

Original Poster
Rep: Reputation: 30
Hi david_ross,
Thanks for your reply.

Please help me on this script :

Code:
<html>
<head>
<title>Show it</title>
<script language="javascript"> 
function showIt(which)
{
// collect all the div names 
for ( var object in document.all.tags ("DIV") )
 { 
	// set all other "target" class divs to hidden
	if ( ( document.all[object].className == "targets" ) && ( object != which ) ) 
	document.all[object].style.visibility = 'hidden'; 
 } 
// then set selected "target" visibility to the opposite of its current value 
document.all[which].style.visibility = document.all[which].style.visibility=='visible' ? 'hidden' : 'visible';
}
</script>
</head>
<body LINK="#0000ff" VLINK="#800080">
<h1>Show It</h1>
<ol>
  <li><a HREF="#" onClick="showIt('div1')">Show Div1</a> </li>
  <li><a HREF="#" onClick="showIt('div2')">Show Div2</a> </li>
</ol>

<div class="targets" id="div1" style="position:absolute;top=155px;left=30px;visibility:hidden">
<h1>This is Div 1</h1>
<table border="1" width="400" height="100">
<td><br>
  <br>This Div will show image 1
  <br>
</td>
</table>
</div>

<div class="targets" id="div2" style="position:absolute;top=155px;left=30px;visibility:hidden">
<h1>This is Div 2</h1>
<table border="1" width="400" height="100">
<td><br>
  <br>This Div will show image 2
  <br>
</td>
</table>
</div>
</body>
</html>
In IE, I can show each of div when I clicked the link, but not in browser for linux. How do I acheive the same result with konqueror or mozilla in MDK9.2
Thanks in advance
 
Old 01-26-2004, 01:03 PM   #4
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 79
You should be able to use:
Code:
show = document.getElementById(which);
show.style.visibility = 'visible';
 
Old 01-26-2004, 08:36 PM   #5
d4d4n9
Member
 
Registered: Oct 2003
Distribution: Mandrake 10.1, Knoppix 3.7
Posts: 153

Original Poster
Rep: Reputation: 30
Thanks David_ross,
I will try it at my Linux box at home.
Back to you later
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript help darin3200 General 4 09-03-2005 11:58 PM
hidding a DIV djgerbavore Programming 1 07-29-2005 03:51 PM
HTML: Opening links in a <div> instead of a fram slizadel Programming 1 10-20-2004 08:20 PM
Question about CGI.pm and the <DIV> tag... kdowney Programming 1 11-11-2003 07:38 PM
Help with javascript? BajaNick Linux - Software 2 07-20-2003 08:41 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration