Cufon Asp.net in master page - asp.net

I try to use Cufon fonts in my web page. I have master page and in head tag I have this:
<script src="js/jquery-1.4.2.js" type="text/javascript"></script>
<script src="js/cufon-yui.js" type="text/javascript"></script>
<script src="js/cufon-replace.js" type="text/javascript"></script>
<script src="js/GeosansLight_500.font.js" type="text/javascript"></script>
<script src="js/Impact_400.font.js" type="text/javascript"></script>
<link href="App_Themes/tDefault/style.css" rel="stylesheet" type="text/css" />
and in the end of MasterPage before end body:
<script type="text/javascript"> Cufon.now();</script>
but in page i have this error: Webpage error details
Message: 'Cufon' is undefined
URI: http://localhost:93/en/
how can I embed this font in asp.net, is this correct way.

In your header put
<head id="Head1" runat="server">
<asp:PlaceHolder runat="server" id="phHeader">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src='<%= ResolveUrl("~/js/cufon-yui.js") %>'></script>
<script type="text/javascript" src='<%= ResolveUrl("~/js/Myriad_Pro_400.font.js") %>'></script>
<script type="text/javascript" src='<%= ResolveUrl("~/js/cufon-replace.js") %>'></script>
</asp:PlaceHolder>
</head>

Is the path to the JavaScript correct?

Related

How to output type=javascript from Scripts.Render using bundles

In My Master page I have the following lines :
<%: Scripts.Render("~/bundles/SiteJS") %>
It correctly outputs the bundles as :
<script src="/Scripts/jquery-2.1.0.min.js"></script>
<script src="/Scripts/ie10-viewport-bug-workaround.js"></script>
<script src="/Scripts/bootstrap.min.js"></script>
<script src="/Scripts/Main.js"></script>
But I want it like this with type="text/javascript"
<script src="/Scripts/jquery-2.1.0.min.js" type="text/javascript"></script>
<script src="/Scripts/ie10-viewport-bug-workaround.js" type="text/javascript"></script>
<script src="/Scripts/bootstrap.min.js" type="text/javascript"></script>
<script src="/Scripts/Main.js" type="text/javascript"></script>
What needs to be done for this ?
This post How do I add type="text/javascript" to a script tag when using System.Web.Optimization
focuses on a single javascript file but I have many files in that bundle.

Jquery autocomplete not working in asp.net

I have a content page in ASP.Net web app.
In that I am trying to use Jquery UI Autocomplete. But it does not work. What is wrong in this page? Here is my code:
<asp:Content ID="Content3" ContentPlaceHolderID="contentMainBody" runat="server" >
<link href="Atlas_Css/menu.css" rel="stylesheet" type="text/css" />
<link href="Atlas_Css/jquery.simplyscroll.css" rel="stylesheet" type="text/css" media="all" />
<link href="Atlas_Css/Jquery%20UI.css" rel="stylesheet" type="text/css" />
<script src="JS_AtlasFly/jquery.js" type="text/javascript"></script>
<script src="Scripts/Validations.js" type="text/javascript"></script>
<script src="JS_AtlasFly/jquery.simplyscroll.js" type="text/javascript"></script>
<script src="JS_AtlasFly/jquery.simplyscroll.min.js" type="text/javascript"></script>
<script src="JS_AtlasFly/js-image-slider.js" type="text/javascript"></script>
<script src="JS_AtlasFly/accordian.pack.js" type="text/javascript"></script>
<script src="JS_AtlasFly/jquery-1.9.1.js" type="text/javascript"></script>
<script src="JS_AtlasFly/jquery-ui.js" type="text/javascript"></script>
<script type="text/javascript">
window.onload = function ()
{
var availableTags = [ <%= PassFname %> ];
$("#txtFname" ).autocomplete({
source: availableTags
});
}
</script>
<div id="testDiv" runat="server">
<asp:Label ID="lblName" runat="server" Text="F Name"></asp:Label> <asp:TextBox ID="txtFname" runat="server"></asp:TextBox>
</div>
NOTE: the server side variable, PassFname, I am populating in code behind .
In a normal asp.Net page , without using master page (within the same project), Autocomplete works fine.
What is wrong in this page? is it because of master page?
What is the solution for this?
Since the same code behind code works in another page, I am not including it here. I have checked it here also, the string variable is populated on page load. Only autocomplete is not binding.
Any help will be appreciated.
I found the solution to this. I used the clientId of the TextBox directly in
Javascript.
like this:
$("#ctl00_contentMainBody_txtFname").autocomplete({
source: availableTags
});
that solved the binding of autocomplete with the textbox's id.
BTW, using <%=txtFname.ClientID%> doesnot solve the issue. Instead the page stops rendering.
So I used the client Id from page source, and it works.
Thanks to all

wordpress error after 3.6 update Uncaught TypeError: Cannot call method 'cookie' of undefined

i have problem with my wordpress page after update to ver 3.6. I didn't make any changes in code but site is not working now, showing the error
Uncaught TypeError: Cannot call method 'cookie' of undefined
code:
<head>
<link rel="stylesheet" href="http://www.ewerosinska.com/wp-content/themes/ewe/style.css" type="text/css">
<link href="http://fonts.googleapis.com/css?family=Quicksand:400,700" rel="stylesheet" type="text/css">
<link rel="stylesheet" id="superstyle-css" href="http://www.ewerosinska.com/wp-content/themes/ewe/js/supersized.core.css" type="text/css" media="screen">
<script type="text/javascript" src="http://www.ewerosinska.com/wp-includes/js/jquery/jquery.js?ver=1.10.2"></script>
<script type="text/javascript" src="http://www.ewerosinska.com/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1"></script>
<script type="text/javascript" src="http://www.ewerosinska.com/wp-content/plugins/jquery-vertical-accordion-menu/js/jquery.hoverIntent.minified.js?ver=3.6"> </script>
<script type="text/javascript" src="http://www.ewerosinska.com/wp-content/plugins/jquery-vertical-accordion-menu/js/jquery.cookie.js?ver=3.6"></script>
<script type="text/javascript" src="http://www.ewerosinska.com/wp-content/plugins/jquery-vertical-accordion-menu/js/jquery.dcjqaccordion.2.9.js?ver=3.6"></script>
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://www.ewerosinska.com/xmlrpc.php?rsd">
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://www.ewerosinska.com/wp-includes/wlwmanifest.xml">
<meta name="generator" content="WordPress 3.6">
<style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>
<script type="text/javascript" src="http://www.ewerosinska.com/wp-content/themes/ewe/js/supersized.3.2.7.js"></script>
<script type="text/javascript">
jQuery(document).ready(function() {
if($.cookie('has_seen_palms')!='1'){
the error appears in the last line, my website adress is ewerosinska.com
Does anyone know hot to fix that?
Thanks a lot
Evelyn

jquery datepicker work in dynamic data

I follow this instruction: http://weblogs.asp.net/dotnetstories/archive/2011/07/01/a-simple-tutorial-on-asp-net-dynamic-data.aspx?CommentPosted=true#commentmessage
I have added the links to my ASP.NET Dynamic Data master page as follow:
<script src="Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="Scripts/jquery-ui-1.8.20.custom.min.js" type="text/javascript"></script>
<link href="NewStyles/ui-lightness/jquery-ui-1.8.20.custom.css" rel="stylesheet" type="text/css" />
I add this code on the top of my DateTime_Edit.ascx.
<script type="text/javascript">
$(document).ready(function () {
$('#<%=TextBox1.ClientID %>').datepicker();
});
But it doesn't work. Any idea?
I used Page.ResolveURL() in src attribiute. Like this one:
<script src='<%=Page.ResolveURL("~/Scripts/jquery-1.7.2.min.js")%>' type="text/javascript"></script>
Check your Site.master file that the EnablePartialRendering value is false and not true
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="false"/>

Javascript alert test not working

I should be sleeping but this is really bugging me. I can't get a simple javascript alert box to display in my asp.net project. Hopefully someone can see what I'm doing wrong. My test page is this:
<%# Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="JSTest.aspx.cs" Inherits="Proj.JSTest" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Header" runat="server">
<script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
<script src="Scripts/jquery-1.4.1.js" type="text/javascript" language="javascript" >
$(document).ready(function() {
alert("Working");
});
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Main" runat="server">
</asp:Content>
The masterpage is pretty standard as well. Here's the header part of it (which I figure is the key bit)
<head runat="server">
<title></title>
<%--<script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script> --%>
<link href="App_Themes/Default/Default.css" rel="stylesheet" type="text/css" />
<asp:ContentPlaceHolder ID="Header" runat="server">
</asp:ContentPlaceHolder>
</head>
I know I must be missing something obvious - probably just need sleep :D. But if anyone can see why this isn't working, that would be great!
Thanks!
Try putting it in another script tag, but without the src attribute.
<script type="text/javascript" language="javascript" >
$(document).ready(function() {
alert("Working");
});
</script>
Or put it in a separate file and include the file using the src attribute.
<script type="text/javascript" language="javascript" src="myJSFile.js"></script>
You are encosing document ready inside the script tag which references jquery. Put that in another script tag like below.
<script src="Scripts/jquery-1.4.1.js" type="text/javascript" language="javascript" ></script>
<script type="text/javascript">
$(document).ready(function() {
alert("Working");
});
</script>
Should be like...
<script src="Scripts/jquery-1.4.1.js" type="text/javascript" language="javascript" ></script>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
alert("Working");
});
</script>
When you got a bug in javascript code, Firebug and Web inspector will be your best friend.
You can see what's wrong in the page. It might that jQuery library not loaded, the produced HTML contains error, missing tags, etc.
Using Firebug or Web Inspector, you can know what is wrong in the page.
include that script within
<script type="text/javascript>
$(document).ready(function() {
alert("Working");
});
</script>

Resources