By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,984 Members | 2,794 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,984 IT Pros & Developers. It's quick & easy.

How can I keep javascript function from displaying in a new window?

P: 38
I just found css code for a fixed menu at the top of the browser so the window under the menu can scroll right on without disturbing the menu. I used
Expand|Select|Wrap|Line Numbers
  1. <a href="javascript:CreateTable()"> </a>
but the table displayed in a new window and I want it to stay in the window that the menu is on. I was using a frame before but I couldn't get the table to display in the main window so now I thought with this CSS code, it would behave itself. Can anyone tell me what I need to do to get subs and functions to display in the menu window? It will be used in aspx.vb eventually
Jan 20 '16 #1
Share this Question
Share on Google+
8 Replies


Dormilich
Expert Mod 5K+
P: 8,639
first thing is to not use a link when you do not want to link something. having the cursor change its shape can be easily done in CSS.

Expand|Select|Wrap|Line Numbers
  1. <span onclick="CreateTable()"> </span>
Jan 21 '16 #2

P: 38
ok Thank you. Where in the code do I place <span onclick="CreateTable()"> </span>?
The menu has
Expand|Select|Wrap|Line Numbers
  1.  <ul>
  2.   <li><a class="active" href="#home">Home</a></li>
  3.   <li><a href="javascript:CreateTable()">Table</a></li>
  4.   <li><a href="#contact">Contact</a></li>
  5.   <li><a href="#about">About</a></li>
  6. </ul>
I didn't know how to submit the js function so I called a html file with CreateTable in javascript.
Jan 21 '16 #3

Dormilich
Expert Mod 5K+
P: 8,639
where you had that link before.
Jan 21 '16 #4

P: 38
It didn't show up as a menu item to click on.
Expand|Select|Wrap|Line Numbers
  1. <style>
  2. body {margin:0;}
  3. ul {list-style-type: none; margin: 0;  padding: 0; overflow: hidden; background-color: #333; position: fixed; top: 0; width: 100%;}
  4. li {float: left;}
  5. li a {display: block; color: white;  text-align: center;   padding: 14px 16px; text-decoration: none;}
  6. li a:hover:not(.active) { background-color: #111;}
  7. .active {background-color: #4CAF50;}
  8. </style>
  9. </head>
  10. <body>
  11. <ul>
  12.   <li><a class="active" href="#home">Home</a></li>
  13.   <li><span onclick="CreateTable()"></span></li>
  14.   <li><a href="#contact">Contact</a></li>
  15.   <li><a href="#about">About</a></li>
  16. </ul>
  17. <div style="padding:20px;margin-top:30px;background-color:#FFFFFF;height:1500px;">
  18. <h1>Fixed Top Navigation Bar</h1>
  19. <h2>Scroll this page to see the effect</h2>
  20. <h2>The navigation bar will stay at the top of the page while scrolling</h2>
  21. </div>
Jan 21 '16 #5

Dormilich
Expert Mod 5K+
P: 8,639
well, a tag with no content in it certainly does not show.
Jan 21 '16 #6

P: 38
I put Table in it and it didn't show up in the menu to be clicked. I have never used span before so I don't know the procedure. I just want a menu to display html table with 88 clickable cells. I have the table but can't get it to display in same window as menu.
Expand|Select|Wrap|Line Numbers
  1. <li><span onclick="CreateTable()">Table</span></li>
Jan 21 '16 #7

Dormilich
Expert Mod 5K+
P: 8,639
do you have a live page for testing?

PS. you need to repeat the styling that you make for these <a> for the <span> as well
Jan 22 '16 #8

P: 38
I use IIS 8 and have localhost to use a browser to run my code. I have aspx files and html files. html work fine except I end up with the html table with 88 cells in the frame and not in the main window just like it does in aspx.vb. code. I tried parent.main.location.CreateTable.html but it displays in the main window but the cells are not clickable so I can't use the next function which relies on which cell was clicked.
Jan 22 '16 #9

Post your reply

Sign in to post your reply or Sign up for a free account.