i am trying to run a little script before redirecting to twitter but it does not show the 'hi' alert? I used this as a reference:https://dev.twitter.com/docs/intents/events
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm6.aspx.cs" Inherits="iFrame.WebForm6" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<head runat="server">
<title></title>
<script src="//platform.twitter.com/widgets.js" type="text/javascript"></script>
<script type="text/javascript">
twttr.events.bind('tweet', function (event) {
// Do something there
alert('hi');
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<iframe allowtransparency="true" frameborder="0" scrolling="no" src="//platform.twitter.com/widgets/tweet_button.html"
style="width: 130px; height: 20px;"></iframe>
</div>
</form>
</body>
</html>
Your code seems to work ( http://jsfiddle.net/JbJ9T/ ) fine, but I've noticed that you're missing an opening <html> tag. I could imagine that this might cause some trouble.
Also, check the console in e.g. Firefox or Safari for Javascript errors and/or notifications that something is missing or in a wrong location if the suggestion above doesn't help.
Related
I nibbling on a bug in ff:
See http://nocturne.wmw.cc/bugff.html (not reproducable in jsfiddle - too bad)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
</head>
<body>
<button disabled="disabled">sdf</button>
<script>
jQuery(function(){
if(!jQuery('button').is(':disabled'))
alert('Is not disabled!');
jQuery('button').removeAttr('disabled');
});
</script>
</body>
</html>
Now the Problem:
If i load the first time, everything is ok.
If i reload the page using Ctrl+r, the alert() shows the error-message.
If i Reload using Ctrl+Shift+r the bug does not occoure.
I do use Microsoft® Windows® 7.
Reproduceable at least at FF28, FF29.
How to solve?
The issue seems to be the same mechanism that stores user-input for form-elements, the state of the button has been cached.
possible solution(see: How can I stop Firefox from caching the contents of a textarea on localhost? ):
<button disabled="disabled" autocomplete="off">sdf</button>
http://jsfiddle.net/doktormolle/4ZLd9/show/
Just try disabled instead of disabled = "disabled"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script>
<body>
<button disabled>sdf</button>
<script>
jQuery(function(){
if(!jQuery('button').is(':disabled'))
alert('Is not disabled!');
jQuery('button').removeAttr('disabled');
});
</script>
</body>
</html>
Im trying to integrate a facebook wall on my .net powered website using the following plugin.
http://www.neosmart.de/social-media/facebook-wall
Ive tried the following and nothing seems to be working, all the scripts are in the correct location and I cant seem to find a problem.
<%# Page Language="C#" AutoEventWireup="true" CodeFile="facebook.aspx.cs" Inherits="facebook" %>
<!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">
<title>Facebook</title>
<script type="text/javascript" src="_includes/js/jquery-1.6.1.min.js"></script>
<link href="_includes/css/jquery.neosmart.fb.wall.css" rel="stylesheet" type="text/css" />
<script src="_includes/js/jquery.neosmart.fb.wall.js" type="text/javascript"></script>
<script type="text/javascript">
$('#live-demo').fbWall({
id: '165674747098261',
accessToken: '206158599425293|7809823973348bcf8cd72f6d.1-100000465435225|BW9n2eoyL7EYvJs7GEmv61NbBFk',
showGuestEntries: true,
showComments: true,
max: 5,
timeConversion: 24
});
</script>
</head>
<body>
<p>hello</p>
<div id="live-demo"></div>
</body>
</html>
You might use the $(document).ready(function(){//your FB.wall code//}); this is the DOM-thing to make the code run when page is ready.
I have iframe that cointains some javascript that should fire on body load,while iframe works fine when embedded on plain HTML page,when integrated in blogger HTML/javascript widget,javascript in iframe don't work..suggestions.Tried only in Firefox bc viruses and toolbars eaten IE?
Iframe Page
<!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>
<title></title>
<script language="javascript" type="text/javascript">
function change() {
var text = "someaddress";
window.location = "http://something.com/fb2.aspx" + "?url=" + text;
}
</script>
</head>
<body bgcolor="#333333" onload="change()">
</body>
</html>
Code of HTML/javascript widget on Blogger Blog
<iframe scrolling="no" src="http://something.com/fb.htm" width="200" height="70"
frameborder="0" name="myInlineFrame"></iframe>
And sam iframe embedded in this plain HTML page executes javascript as it should
<!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>
<title>Test Stats page</title>
</head>
<body>
<iframe src="fb.htm" runat="server" id="iframe1" width="500" height="500"></iframe>
</body>
</html>
Behind the scenes, it appears that the Blogger Widget/Gadget system is using a method of adding code to the DOM that precludes the execution of any JavaScript. Oftentimes, this can happen if content is added by appending it to the .innerHTML object. The DOM element is rendered, but any included JavaScript does not execute.
A workaround for this is outside the scope of this question, because it's a blogger issue.
The solution for you is to edit the Blogger template directly, and paste your IFRAME where you would like it to appear in the template itself. In other words, don't use a widget.
Below is a portion of my own Blogger Template with an iframe right before the closing body element:
</div>
</div>
</div>
<script type='text/javascript'>
window.setTimeout(function() {
document.body.className = document.body.className.replace('loading', '');
}, 10);
</script>
<!-- Iframe in template -->
<iframe scrolling="no" src="http://somedomain.com/fb.htm" width="200" height="70"
frameborder="0" name="myInlineFrame"></iframe>
<!-- Iframe in template -->
</body>
<macro:includable id='sections' var='col'>
<macro:if cond='data:col.num == 0'>
<macro:else/>
I am just trying to get this plugin to work but I am not sure what I am doing wrong.
http://code.google.com/p/sevenup/
So I tried to follow the one like of code they give you.
<script type="text/javascript" src="sevenup.0.3.min.js"></script>
...
<body onload="sevenUp.test( options, callback );">
My test page.
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
<script src="sevenup.0.3.js" type="text/javascript"></script>
</head>
<body onload="sevenUp.test( options, callback );">
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
So I did that and I get "option" is not defined.
So I tried this then
<%# Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<!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">
<title>Untitled Page</title>
<script src="sevenup.0.3.js" type="text/javascript">
var options = {
enableClosing: true,
enableQuitBuggingMe: true,
overlayColor: "#000000",
lightboxColor: "#ffffff",
borderColor: "#6699ff",
downloadLink: osSupportsUpgrade ?
"http://www.microsoft.com/windows/internet-explorer" :
"http://getfirefox.com",
overrideLightbox: false,
lightboxHTML: null,
showToAllBrowsers: false
};
var callback = function() {
// Switch IE-specific content
// AJAX call to map IP to 'IE6 user' status
// etc.
}
sevenup.test(options, callback);
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
but nothing happens.
What am I missing.
Can someone set me an example up? Like I tried many different ways other then above and I still can't get it to work.
A standard Html page should be fine. Since this really does not need serverside stuff.
Here is a standard html page.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
<script type="text/javascript" src="sevenup.0.3.js"></script>
<script type="text/javascript" src="sevenup_black.0.3.js"></script>
</head>
<body onload="sevenUp.plugin.black.test( options, callback );">
</body>
</html>
So not sure what I am still doing wrong. Get options undefined.
Try passing an empty options object and function as a parameter. The options variable is NOT exposed by the script and that seems to be why it says it's undefined (because it is). The callback variable isn't exposed either.
sevenUp.test({}, function(){} );
You could also easily load up the page in Firefox, put up a breakpoint and inspect the local variables.
You're using ASP.NET and the Body OnLoad is not a great place for putting JavaScript hooks.
Add this to the very bottom of your page before the </body> tag:
<script type="text/javascript">
// Call sevenUp
sevenUp.test( options, callback );
</script>
Another thing you want to do is make sure that you are referencing the correct path to the source JavaScript file:
<script type="text/javascript" src="<%=ResolveClientURL("~") %>/Scripts/sevenup.0.3.min.js"></script>
Remove the runat="server" from your <head> tag. That should fix it.
JQuery is not working in ASP 2.0 pages which were developed under VS 2005 and now doing Javascript in it using Visual Web Developer 2008 Express. I have included the jquery file.
I have also installed all patches required. JQuery intellisense works fine in the IDE, but no jquery command is running. btw, the page renders fine from the server side coding.
Please give some remedy to this, and whats the problem in the code?
<%# Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
<%# Register Src="Calendar.ascx" TagName="Calendar" TagPrefix="uc1" %>
<!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">
<title>Control Trial Page</title>
<link href="StyleSheet.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="Scripts/jquery-1.3.2.js">
$(document).ready(function() {
$("#divBody").css("display", "none");
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input id="showDiv" type="button" value="hi there"/>
</div>
<div id="divBody">
....
</html>
You need 2 script tags. One which imports the jQuery.js file and one which contains your script. Observe:
<script language="javascript" type="text/javascript" src="Scripts/jquery-1.3.2.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function() {
$("#divBody").css("display", "none");
});
</script>