Click here to Skip to main content
15,918,808 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
plz help me java script code not working on master page in my project

on master page i am trying calender control on texbox

XML
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage2.master.cs" Inherits="MasterPage2" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <asp:ContentPlaceHolder id="head" runat="server">

    </asp:ContentPlaceHolder>
    <title>Education Gateway</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
    <link rel="stylesheet"  href="Bootstrap Files/css/bootstrap.min.css" type="text/css" />
    <link rel="stylesheet" href="Bootstrap Files/css/bootstrap-theme.min.css" type="text/css" />

this is javascript file calling from solution explorar

 <script language="javascript" src="cal2.js">
</script>
<script language="javascript" src="cal_conf2.js"></script>


</head>
<body>




ON CONTENT PAGE

XML
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" name="sampleform"    Runat="Server">
    <br />
    <br />
    <div style="margin-left: -3px; margin-top:165px; width: 1007px;">
    <strong><asp:Label ID="Label15" runat="server" style="color: #FF3300" Text="Label"></asp:Label>
                </strong>
    <table class="table table-hover">
        <tr class="info">
            <td colspan="4" class="auto-style3" style="text-align:center"><strong><em style="font-size: large; color: #006600">Student Registration</em></strong></td>
        </tr>
        <tr class="info">
            <td class="auto-style17">
                <asp:Label ID="Label2" runat="server" Text="Date" style="font-size: large; font-weight: 700" ></asp:Label></td>
            <td class="auto-style18" >
               <%-- <asp:TextBox ID="TextBox1"  runat="server"  data-toggle="tooltip"
        title=" Date " placeholder=" Today Date" Height="22px" Width="297px" EnableTheming="False"></asp:TextBox>--%>

THIS IS CALL JAVASCRIPT FUNCTION ON CONTENT PAGE 
  <input type="text" name="firstinput" size=20> <small><a href="javascript:showCal('Calendar1')">Select Date</a></small>
Posted
Updated 5-Aug-14 19:22pm
v2
Comments
Rafeeque B Muhammad 6-Aug-14 1:12am    
provide more details what you are trying?
Sergey Alexandrovich Kryukov 6-Aug-14 1:20am    
It is not working because you screwed it up.

Is it clear enough for you to solve your problem? My answer is at least not less certain that your "question". Isn't that obvious?

—SA

1 solution

What exactly you are trying ? Please provide us some more details.
When you are using master page , the client id's will get changed something like "ctl000_ContentPlaceHolder1_ txtitems", and it is browser dependent. so every browser may show different id's. So you need to find the actual clienID before you proceed with javascript
Please refer Master Pages and JavaScript document.getElementById[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900