?
Solved

Issue in code

Posted on 2011-10-25
6
Medium Priority
?
234 Views
Last Modified: 2012-05-12
Hi

What is the issue in the code.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Write_Output_Write.aspx.cs"
    Inherits="Write_Output_Write" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <%--<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />--%>
    <title></title>

    <script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>

    <script language="javascript" type="text/javascript">
        $(document).ready(
            function() {
                $("ul#websiteList li a").click(
                    function($e) {
                        alert("Hello");
                    }
                );
            }
        );
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <ul id="websiteList">
        <li><a href="http://www.google.com">google</a></li>
    </ul>
    <ul>
        <li><a href="http://www.rediff.com">Rediff</a></li>
    </ul>
    </form>
</body>
</html>

Open in new window


When I click on the link message box is not coming.

Regards
Karan Gupta
0
Comment
Question by:KaranGupta
  • 4
6 Comments
 
LVL 17

Accepted Solution

by:
sonawanekiran earned 2000 total points
ID: 37023377
Check this

Test page : http://jsfiddle.net/TpSZG/2/
<html>
<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Kiran Test</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>

<script>
$(document).ready(function(){
  
          $("ul#websiteList li a").click(
                    function($e) {
                        alert("Hello");
                    }
                );    
  
   
  });
  
  
</script>
</head>

<body>
 <ul id="websiteList">
        <li><a href="http://www.google.com">google</a></li>
    </ul>
    <ul>
        <li><a href="http://www.rediff.com">Rediff</a></li>
    </ul>
  
</body>

</html>

Open in new window

0
 
LVL 17

Expert Comment

by:sonawanekiran
ID: 37023381
With your code
<html>
<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Kiran Test</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>

<script>

  
  
</script>
</head>

<body>
 <ul id="websiteList">
        <li><a href="http://www.google.com">google</a></li>
    </ul>
    <ul>
        <li><a href="http://www.rediff.com">Rediff</a></li>
    </ul>
  
</body>

</html>


<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Write_Output_Write.aspx.cs"
    Inherits="Write_Output_Write" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <%--<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" />--%>
    <title></title>

    <script src="http://code.jquery.com/jquery-latest.js" type="text/javascript"></script>

    <script language="javascript" type="text/javascript">
      $(document).ready(function(){
  
          $("ul#websiteList li a").click(
                    function($e) {
                        alert("Hello");
                    }
                );    
  
   
  });
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <ul id="websiteList">
        <li><a href="http://www.google.com">google</a></li>
    </ul>
    <ul>
        <li><a href="http://www.rediff.com">Rediff</a></li>
    </ul>
    </form>
</body>
</html>

Open in new window

0
 

Author Comment

by:KaranGupta
ID: 37023396
HI sonawanekiran

I don't see any difference in the code. What is the difference in the code? I have executed both the codes and is not working.

Regards
Karan Gupta
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 17

Expert Comment

by:sonawanekiran
ID: 37023430
Yes. Both of our code is correct. Sorry I haven't checked your code. Do you want to show the alert when you click on Rediff also?
0
 
LVL 17

Expert Comment

by:sonawanekiran
ID: 37023467
Below link is domo for your script

http://jsfiddle.net/TpSZG/2/

When you click on google it shows the alert "Hello"
0
 
LVL 11

Expert Comment

by:kelvinwkw
ID: 37024543
Try either of the below

<body>
 <ul id="websiteList">
        <li><a href="http://www.google.com">google</a></li>
        <li><a href="http://www.rediff.com">Rediff</a></li>
    </ul>
</body>

or

<body>
 <ul id="websiteList">
        <li><a href="http://www.google.com">google</a></li>
    </ul>
    <ul id="websiteList">
        <li><a href="http://www.rediff.com">Rediff</a></li>
    </ul>
</body>
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Suggested Courses
Course of the Month16 days, 6 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question