🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: pl.comp.lang.javascript
2 messages
2 total messages Started by Jivanmukta Mon, 10 Jul 2023 07:12
<a href="javascript:main();"> does not work
#52044
Author: Jivanmukta
Date: Mon, 10 Jul 2023 07:12
35 lines
1926 bytes
In index.html file I have:

<body>

   <nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top">
     <a class="navbar-brand" href="javascript:main();">Tron Game</a>
     <button class="navbar-toggler" type="button" data-toggle="collapse" 
data-target="#navbarsExampleDefault" aria-controls="navbarsExampleDefault"
       aria-expanded="false" aria-label="Toggle navigation">
       <span class="navbar-toggler-icon"></span>
     </button>

     <div class="collapse navbar-collapse" id="navbarsExampleDefault">
       <ul class="navbar-nav mr-auto" id="score-list">
       </ul>
     </div>
   </nav>

   <main role="main" class="container-fluid">
     <div class="game-container">
       <canvas id="myCanvas" width=600 height=600 style="border:2px 
solid #eee;">
       </canvas>
     </div>
   </main>
   <!-- /.container -->

   <script src="./index.js"></script>

</body>

File index.js contains many functions, for example main(). I want to 
have main() called when user clicks on Tron Game text.
The solution above does not work, nothing happends when Tron Game link 
is clicked.
Re: <a href="javascript:main();"> does not work
#52045
Author: zpksoft
Date: Mon, 10 Jul 2023 15:44
13 lines
1634 bytes
poniedziałek, 10 lipca 2023 o 09:12:23 UTC+2 Jivanmukta napisał(a):
> In index.html file I have: 
> 
> <body> 
> 
> <nav class="navbar navbar-expand-md navbar-dark bg-dark fixed-top"> 
> <a class="navbar-brand" href="javascript:main();">Tron Game</a> 

try:

<a class="navbar-brand" href="#" onclick="main();">Tron Game</a>

Paweł
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads